qq_28314573 2016-04-07 03:50 采纳率: 0%
浏览 1447

@Autowired问题和SimpleJdbcTemplate(过期)问题,运行报错如下,求解决方案

2016-04-07 10:30:02 [ERROR] - org.springframework.web.context.ContextLoader -ContextLoader.java(318) -Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'baseDaoImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.springTest.util.DBUtil com.springTest.baseDaoImpl.BaseDaoImpl.util; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'util' defined in file [D:\360安全浏览器下载\apache-tomcat-7.0.52-windows-x64\apache-tomcat-7.0.52\webapps\student\WEB-INF\classes\com\springTest\util\DBUtil.class]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.springframework.jdbc.core.simple.SimpleJdbcTemplate' to required type 'javax.sql.DataSource' for property 'simpleJdbcTemplate'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.springframework.jdbc.core.simple.SimpleJdbcTemplate] to required type [javax.sql.DataSource] for property 'simpleJdbcTemplate': no matching editors or conversion strategy found
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:287)

Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.springTest.util.DBUtil com.springTest.baseDaoImpl.BaseDaoImpl.util; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'util' defined in file [D:\360安全浏览器下载\apache-tomcat-7.0.52-windows-x64\apache-tomcat-7.0.52\webapps\student\WEB-INF\classes\com\springTest\util\DBUtil.class]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.springframework.jdbc.core.simple.SimpleJdbcTemplate' to required type 'javax.sql.DataSource' for property 'simpleJdbcTemplate'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.springframework.jdbc.core.simple.SimpleJdbcTemplate] to required type [javax.sql.DataSource] for property 'simpleJdbcTemplate': no matching editors or conversion strategy found
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:513)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:92)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:284)
... 27 more

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'util' defined in file [D:\360安全浏览器下载\apache-tomcat-7.0.52-windows-x64\apache-tomcat-7.0.52\webapps\student\WEB-INF\classes\com\springTest\util\DBUtil.class]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.springframework.jdbc.core.simple.SimpleJdbcTemplate' to required type 'javax.sql.DataSource' for property 'simpleJdbcTemplate'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.springframework.jdbc.core.simple.SimpleJdbcTemplate] to required type [javax.sql.DataSource] for property 'simpleJdbcTemplate': no matching editors or conversion strategy found
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)

Caused by: java.lang.IllegalStateException: Cannot convert value of type [org.springframework.jdbc.core.simple.SimpleJdbcTemplate] to required type [javax.sql.DataSource] for property 'simpleJdbcTemplate': no matching editors or conversion strategy found
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:247)
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:470)
  • 写回答

1条回答 默认 最新

  • 南风沁雨 2016-04-20 09:24
    关注

    你这个是启动tomcat服务器报错了是吧,在spring容器加载 bean的时候 遇到的错误,你看下 需要加载的bean 的注解是否写对了,

    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料