更新:从9.4.25.v20191220开始的码头中存在此问题,我已将版本设置回9.4.24,可以正确使用。我不知道这是错误还是配置更改。
也许有人可以帮忙,我很欣赏这是所有配置问题,但只有将spring-boot-starter-parent从2.1.10-RELEASE升级到2.1.13-RELEASE的问题。
使用@SpringBootApplication以及其他所有默认设置,但以下WebMvcConfigurer除外(请参见另一篇文章here)
@Configuration
public class WebApplicationConfiguration implements WebMvcConfigurer
{
@Override
public void addViewControllers(ViewControllerRegistry registry)
{
registry
.addViewController("/{spring:\\w+}")
.setViewName("forward:/");
registry
.addViewController("/**/{spring:\\w+}")
.setViewName("forward:/");
registry
.addViewController("/{spring:\\w+}/**{spring:?!(\\.js|\\.css|\\.svg)$}")
.setViewName("forward:/");
}
}
使用码头,并且在\ src \ resources \ public \中有一个角度项目,包括公共目录中的index.html。
在先前的春季版本中,我可以导航到localhost:8080,它将自动定向到localhost:8080 / list,已将其设置为角度项目索引文件中的重定向。
但是现在使用2.1.13,我必须显式转到可以正常工作的localhost:8080 / index.html,重定向到/ list,然后我可以浏览网站,但是如果刷新页面或显式地转到:8080 /清单我得到whitelabel error 500
我尝试过:
1。
添加其他各种视图控制器规则:
registry.addViewController("/").setViewName("forward:/index.html");
registry.addViewController("/").setViewName("forward:index.html");
registry.addViewController("/**").setViewName("forward:index.html");
...但是我认为这些都不是问题。
2。
已查看ResourceHandlerRegistry以查看默认资源位置,因此它应该获取我的index.html文件。
3。
添加spring.resources.static-locations = classpath:/ public / xxx / **
然后我进入localhost:8080 / xxx /或localhost:8080 / xxx / index.html whitelabel 404
我由于安全漏洞而升级了spring,因此目前倾向于回到2.1.10或11,并仅拉取缓解漏洞所需的依赖项版本。我只想了解出了什么问题,显然不喜欢被打败。
有谁知道spring的版本是否存在变更日志,这些变更日志可以揭示出已更改的内容?我想可能是由于任何数量的依赖项目。
因此事实证明,无论是什么问题,都已在码头9.4.27.v20200227中解决。
2.1.10的Spring Boot发行版包含每个发行版的新Jetty版本,当前发行版当前使用的是9.4.27。
使用带有9.4.27.v20200227的spring boot 2.1.13-RELEASE,将转发返回到使用localhost:8080 loading / list所期望的状态