Spring MVC集成thymeleaf时提示:defined in ServletContext resource [/WEB-INF/SrpingMVCTest-servlet.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException
错误提示:
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>
参考:
Spring MVC集成thymeleaf时提示:defined in ServletContext resource [/WEB-INF/SrpingMVCTest-servlet.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException的更多相关文章
- 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 ...
- 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 ...
- 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 ...
- nested exception is org.springframework.beans.factory.BeanCreationException: 不能注入对象 创建对象失败 spring
[出现错误的背景] 在使用Spring+SpringMVC+Mybatis SSM集成框架时,服务器启动就会报错. [错误根源] XML配置错误. [解决方案] 第一步.查找springmvc.xml ...
- 报错: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 ...
- 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 ...
- Spring Boot集成Thymeleaf
Thymeleaf是一个java类库,是一个xml/xhtml/html5的模板引擎,可以作为mvc的web应用的view层.Thymeleaf提供了额外的模块与Spring MVC集成,所以我们可以 ...
- spring mvc 集成freemarker模板
主要使用到的jar 文件:spring mvc +freemarker.jar 第一步:spring mvc 集成 freemarker <!-- 定义跳转的文件的前后缀 ,视图模式配置--&g ...
- Spring MVC集成slf4j-logback
转自: Spring MVC集成slf4j-logback 1. Spring MVC集成slf4j-log4j 关于slf4j和log4j的相关介绍和用法,网上有很多文章可供参考,但是关于logb ...
随机推荐
- G - And Then There Was One (约瑟夫环变形)
Description Let’s play a stone removing game. Initially, n stones are arranged on a circle and numbe ...
- python程序展现图片遇到的坑
使用cv2展示图片的时候遇到了问题,提示:TypeError: Required argument 'mat' (pos 2) not found 给定的图片路径是没得问题的,代码如下: 使用open ...
- 树莓派 关闭屏保 / RaspberryPi turn off ScreenSaver / RaspberryPi disable screen off
安装xscreensaver并配置 见:https://www.raspberrypi.org/forums/viewtopic.php?t=57552
- mysql timeout expired处理
一.发现问题 二.分析问题 .net长时间连接mysql导致超时: 方式一:连接用完后,就关闭连接 方式二:增加C#的执行sqlcommand时间 三.解决问题 增加了这一句,问题解决了 using ...
- javascript 数字日期格式转换为中文
写一个函数,把数字日期如2014-06-21转换为 二零一四年六月二十一日星期三 function convert(dateStr) { var dict = { "0": &qu ...
- sed -i 报错的情况
是因为替换的变量中带/的目录名 将原来的/改成#
- 微信小程序组件解读和分析:三、swiper滑块视图
swiper滑块组件说明: 滑块视图容器,用于展示图片,可以通过用户拖拽和设置自动切换属性控制图片的切换 组件的使用示例的运行效果如下: 下面是WXML代码: [XML] 纯文本查看 复制代码 ? ...
- outlook 2016 接收发送无法及时收下邮件,如何更改接收时间?
1. 单击“文件” > “选项” > “高级” > “发送和接收”,单击”发送/接收“ 2. 组“所有账户”的设置 > 打勾“安排自动发送/接收的时间间隔为(V)” 1 分钟 ...
- adb 命令收藏学习地址
adb 命令相关的网页https://www.cnblogs.com/medsonk/p/8334847.htmlhttps://www.cnblogs.com/medsonk/p/6959658.h ...
- spring cloud (一):大话 Spring Cloud
转自:http://www.ityouknow.com/springcloud/2017/05/01/simple-springcloud.html 研究了一段时间Spring Boot了准备向Spr ...