错误提示:

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

Spring MVC集成thymeleaf时提示:defined in ServletContext resource [/WEB-INF/SrpingMVCTest-servlet.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException的更多相关文章

  1. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stu' defined in class path resource [applicationContext.xml]: Instantiation of bean failed; nested exception is

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stu' defined ...

  2. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [app2.xml]: Instantiation of bean failed; nested exception is org.spr

    在学习spring整合hubernate时遇到的问题.c3p0遇到了一个问题,老连不上,显示java.lang.NoClassDefFoundError:com.mchange.v2.ser.Indi ...

  3. spring Boot启动报错Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotatedElementUtils.getAnnotationAttributes

    spring boot 启动报错如下 org.springframework.context.ApplicationContextException: Unable to start web serv ...

  4. nested exception is org.springframework.beans.factory.BeanCreationException: 不能注入对象 创建对象失败 spring

    [出现错误的背景] 在使用Spring+SpringMVC+Mybatis SSM集成框架时,服务器启动就会报错. [错误根源] XML配置错误. [解决方案] 第一步.查找springmvc.xml ...

  5. 报错:defined for 'courierAction_pageQuery' in namespace '/'Error creating bean with name 'cn.itcast.bos.web.action.base.CourierAction': Injection of autowired dependencies failed; nested exception is or

    No qualifying bean of type [cn.itcast.bos.web.service.base.CourierService] found for dependency: exp ...

  6. MyBatis笔记----报错:Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/ij34/mybatis/applicationContext.xml]: Invocation of init method failed; nested exception is org.sp

    四月 05, 2017 4:51:02 下午 org.springframework.context.support.ClassPathXmlApplicationContext prepareRef ...

  7. Spring Boot集成Thymeleaf

    Thymeleaf是一个java类库,是一个xml/xhtml/html5的模板引擎,可以作为mvc的web应用的view层.Thymeleaf提供了额外的模块与Spring MVC集成,所以我们可以 ...

  8. spring mvc 集成freemarker模板

    主要使用到的jar 文件:spring mvc +freemarker.jar 第一步:spring mvc 集成 freemarker <!-- 定义跳转的文件的前后缀 ,视图模式配置--&g ...

  9. Spring MVC集成slf4j-logback

    转自: Spring MVC集成slf4j-logback 1.  Spring MVC集成slf4j-log4j 关于slf4j和log4j的相关介绍和用法,网上有很多文章可供参考,但是关于logb ...

随机推荐

  1. 最大流增广路(KM算法) HDOJ 1533 Going Home

    题目传送门 /* 最小费用流:KM算法是求最大流,只要w = -w就可以了,很经典的方法 */ #include <cstdio> #include <cmath> #incl ...

  2. 构造 Codeforces Round #107 (Div. 2) B. Phone Numbers

    题目传送门 /* 构造:结构体排个序,写的有些啰嗦,主要想用用流,少些了判断条件WA好几次:( */ #include <cstdio> #include <algorithm> ...

  3. HBuilder发行原装安装包操作记录

    1.在左侧"项目管理器"中选择项目: 2.点击菜单栏中的"发行-->发行为原生安装包": 3.在弹出的App云端打包中填写相关信息: IOS开发者证书配置 ...

  4. 20 如何在C#中存一批数据,数组

    使用软件的一个重要原因,是因为软件可以帮我们重复处理很多事情.在前面我们已经讲到了循环.循环就是为了重复处理一个事情.那么我们有没有想过,我们要重复处理的一批数据怎么在程序里存放呢? 举个例子吧. 我 ...

  5. 01按照官方步骤编译NanoPiM1Plus的Android

    01按照官方步骤编译NanoPiM1Plus的Android 大文实验室/大文哥 壹捌陆捌零陆捌捌陆捌贰 21504965 AT qq.com 完成时间:2017/12/6 10:58 版本:V1.0 ...

  6. 华硕(ASUS)X554LP笔记本重装win7后网卡和USB驱动问题的解决

    以前在其它笔记本上采用U盘克隆安装winxp系统非常顺利,各种硬件驱动能自动识别并安装. 手上有一台别人的华硕(ASUS)X554LP笔记本,原装win8.1,用不惯,想装个win7旗舰版. 照例去系 ...

  7. jquery.ajax之beforeSend方法使用介绍

    常见的一种效果,在用ajax请求时,没有返回前会出现前出现一个转动的loading小图标或者“内容加载中..”,用来告知用户正在请求数据.这个就可以用beforeSend方法来实现. 下载demo:a ...

  8. HDU_1114_piggy-bank

    Piggy-Bank Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit S ...

  9. java虚拟机(九)--常用jvm参数

    1.-Xms20M: 表示设置JVM启动内存的最小值为20M,必须以M为单位 2.-Xmx20M: 表示设置JVM启动内存的最大值为20M,必须以M为单位.将-Xmx和-Xms设置为一样可以避免JVM ...

  10. 后台中的sql注入

    aa.getSqlMap().put("order"," and a.id not in(\'"+po.getId()+"\')"); \' ...