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 如何实验stm32主通道和互补通道独立输出
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题