Spring 配置Thymeleaf时出现ServletContextTemplateResolver no Matching constructor.....
2017-06-21 16:33
162 查看
<bean id="templateResolver" class="org.thymeleaf.templateresolver.ServletContextTemplateResolver"> <property name="prefix" value="/WEB-INF/views/" /> <property name="suffix" value=".html" /> <property name="templateMode" value="HTML5" /> </bean> <bean id="templateEngine" class="org.thymeleaf.spring4.SpringTemplateEngine"> <property name="templateResolver" ref="templateResolver" /> </bean> <bean class="org.thymeleaf.spring4.view.ThymeleafViewResolver"> <property name="templateEngine" ref="templateEngine" /> </bean>
解决办法就是替换成同样继承 虚拟类 AbstractConfigurableTemplateResolver 的类,代码如下
<bean id="templateResolver" class="org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver"> <property name="prefix" value="/WEB-INF/views/" /> <property name="suffix" value=".html" /> <property name="templateMode" value="HTML5" /> </bean> <bean id="templateEngine" class="org.thymeleaf.spring4.SpringTemplateEngine"> <property name="templateResolver" ref="templateResolver" /> </bean> <bean class="org.thymeleaf.spring4.view.ThymeleafViewResolver"> <property name="templateEngine" ref="templateEngine" /> </bean>
相关文章推荐
- Spring声明式事务配置上去后出现如下报错:java.lang.ClassCastException: $Proxy1解决
- 关于转载Spring 的MVC I18N-国际化相关配置出现的问题
- Spring配置文件的applicationContext.xml文件头部出现红叉
- spring配置文件没有错,但是出现红叉的解决方法
- spring的xml配置文件出现问题
- Spring事务配置上去后出现如下报错:java.lang.ClassCastException: $Proxy1解决
- Spring配置文件中突然出现异常Referenced file contains errors
- 解决问题:Myeclipse配置spring时出现applicationContext.xml红叉
- 在Spring中配置Thymeleaf的方法
- 编写spring配置文件时,不能出现帮助信息
- Spring 的MVC I18N-国际化相关配置出现的问题
- maven 配置 struts2 hibernate3 spring2 的时候出现的问题
- 配置spring的时候出现的错误
- spring 配置junit 启动时出现 ClassNotFound警告
- 当Spring正确配置注解后还出现NoSuchBeanDefinitionException
- Spring配置文件加载时出现Bean property 'newscontentDAO' is not writable or has an invalid setter method错误的解决[00原创]
- Spring配置Hibernate时出现的错误
- Spring中使用proxool连接池的配置方式与出现Attempt to refer to a unregistered pool by its alias 'ums'异常的解决办法
- Spring学习中出现的问题(一)——配置启动篇(服务器为Tomcat)
- SPRING + THYMELEAF 配置