由于在weblux临时增加一个H5的页面,发生如下错误
Whitelabel Error Page
This application has no configured error view, so you are seeing this as a fallback.
Fri Nov 27 11:18:57 CST 2020
There was an unexpected error (type=Internal Server Error, status=500).
Could not resolve view with name 'index'.
最开始以为是视图路径的问题,测试没通过,考虑其它的解决方案,在网上找了一些,其实朋友说需要增加自定义模板配置,遂记录之.
@Configuration @EnableWebFlux public class WebAppConfig implements WebFluxConfigurer { //引入spring-boot-starter-thymeleaf自动会注入该bean @Autowired private ThymeleafReactiveViewResolver thymeleafReactiveViewResolver; /** * 加入thymeleaf试图解析器,不然找不到view name * * @param registry */ @Override public void configureViewResolvers(ViewResolverRegistry registry) { registry.viewResolver(thymeleafReactiveViewResolver); } }