启动失败:NullPointerException
原因主要是swagger旧版本的bug与,解决方案:
swagger升级到2.5.0+
参考:
https://github.com/spring-cloud/spring-cloud-consul/issues/121
https://segmentfault.com/a/1190000006595187
http://blog.csdn.net/caidchen/article/details/73949624
Caused by: java.lang.NullPointerException: null
at springfox.documentation.schema.property.OptimizedModelPropertiesProvider.beanDescription(OptimizedModelPropertiesProvider.java:317) ~[springfox-schema-2.2.2.jar:2.2.2]
at springfox.documentation.schema.property.OptimizedModelPropertiesProvider.propertiesFor(OptimizedModelPropertiesProvider.java:117) ~[springfox-schema-2.2.2.jar:2.2.2]
at ....
部署生产环境访问异常:NumberFormatException: For input string: "80,80":
2017/9/14 下午2:44:36java.lang.NumberFormatException: For input string: "80,80"
2017/9/14 下午2:44:36 at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
2017/9/14 下午2:44:36 at java.lang.Integer.parseInt(Integer.java:580)
2017/9/14 下午2:44:36 at java.lang.Integer.parseInt(Integer.java:615)
2017/9/14 下午2:44:36 at springfox.documentation.swagger2.web.HostNameProvider.componentsFrom(HostNameProvider.java:72)
2017/9/14 下午2:44:36 at springfox.documentation.swagger2.web.Swagger2Controller.getDocumentation(Swagger2Controller.java:84)
检查代码是,2.5.0引入的HostNameProvider.class中如下代码引起:
String port = request.getHeader("X-Forwarded-Port");
if (hasText(port)) {
builder.port(Integer.parseInt(port));
}
解决方案:升级到2.7.0版本
升级2.7.0后访问,页面无数据
原因:前端控制台报js错误;
解决方案:ctrl+f5清空下浏览器缓存,重新访问