最近回顾了下之前的知识,在使用注解整合SpringMVC+Thymeleaf时遇到点小bug
我的Bug环境(Spring5)
我是照着官网的配置来的,错误的起因在这一处配置上:
问题出在`viewResolver.setViewNames(new String[]{".html", ".xhtml"});`这行代码上,注释即可
此配置的含义是:
当我们需要使用多个模板引擎时,例如JSP+Thymeleaf时候,我们需要区分一下我们的定义的这个试图解析器,需要解析哪些文件,所以这样的话,也可以将代码改成如下形式,也可解决此Bug,如下(home,user分别代表"home.html","user.html")
本解决方案只是提供了在本环境下的一种可能方案,不能保证一定有效,如有建议,评论区留言
相关文章
- @Value引入属性失败 java.lang.IllegalArgumentException: Could not resolve placeholder
- IDEA聚合项目子项目不能install ,报错误 Failed to execute goal on project ... ;Could not resolve dependencies for
- efined in null, could not be registered. A bean with that name has already been defined in null and
- springboot启动错误 Could not resolve placeholder
- Eclipse使用问题—svn Could not create the view
- git clone 时报错,提示 ssh: Could not resolve hostname github.com: Name or service not known
- 打开sg-uap报错:An error has occurred. See the log file... :!MESSAGE Could not resolve module:
- 加入FeignClient项目启动报错:Could not resolve element type of Iterable type xxxx. Not declared?
- could not resolve all dependencies for configuration ‘:app:debugruntimeclasspath‘.
- Could not resolve dependencies for project