错误提示:

defined in ServletContext resource [/WEB-INF/SrpingMVCTest-servlet.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.thymeleaf.templateresolver.ServletContextTemplateResolver]: No default constructor found; nested exception is java.lang.NoSuchMethodException: org.thymeleaf.templateresolver.ServletContextTemplateResolver.<init>()

解决方法:

由于是从2.0版本升到3.0版本的原因,写法变了,应该在Bean上这样注入:

    <!-- thymeleaf -->
<bean id="templateResolver" class="org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver">
<property name="prefix" value="/WEB-INF/templates/" />
<property name="suffix" value=".html" />
<property name="templateMode" value="HTML" />
<property name="cacheable" value="false" />
</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" />
<!--解决中文乱码-->
<property name="characterEncoding" value="UTF-8"/>
</bean>

参考:

https://stackoverflow.com/questions/38057341/failed-to-instantiate-org-thymeleaf-templateresolver-servletcontexttemplatereso

最新文章

  1. Ural-1146Maximum Sum-最大子矩阵
  2. 苹果Mac OS X显示隐藏文件的方法
  3. php变量与数组相互转换的方法(extract与compact
  4. (转)MapReduce 中的两表 join 几种方案简介
  5. [CF787D]遗产(Legacy)-线段树-优化Dijkstra(内含数据生成器)
  6. thinkphp后台ajaxReturn提示下载的问题
  7. (六) Keras 模型保存和RNN简单应用
  8. react native中使用ScrollableTabView
  9. sudo命令 和限制root 远程登陆
  10. jq以固定开头的class属性的名称
  11. 5月23日——SPA单页面应用的原理
  12. iis部署wcf服务
  13. jmeter正则表达式提取器--关联
  14. python调用虹软2.0第三版
  15. Paket介绍
  16. Unity3D手机平台分辨率自动匹配教程
  17. Symfony 建立一个Bundle
  18. Python logger模块
  19. PHPredis长连接pconnect
  20. 【codeforces 1025E】Colored Cubes 【构造】

热门文章

  1. LPS HDOJ 4745 Two Rabbits
  2. 290 Word Pattern 单词模式
  3. leetcode650 2 Keys Keyboard
  4. bat 获取当前路径
  5. ES6特性之模块【Modules】
  6. JavaScript(十三)面向对象
  7. 关于Apache mod_rewrite的中文配置、使用和语法介绍(实现URL重写和防盗链功能)
  8. wpf 自定义Button按钮
  9. kvm--virsh命令行下管理虚拟机
  10. 网络编程 - 简单的socket例子