解决Unsatisfied dependency expressed through field ‘jdbcTemplate‘;问题~

简介: 解决Unsatisfied dependency expressed through field ‘jdbcTemplate‘;问题~

错误描述如下:

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean

错误原因中的下述代码是重点,大概意思为,没有匹配到对应的bean,而这个bean的类型为'org.springframework.jdbc.core.JdbcTemplate'

Error creating bean with name 'bookDaoImpl': Unsatisfied dependency expressed through field 'jdbcTemplate'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.jdbc.core.JdbcTemplate' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

因此解决办法为,在对应的XML文件中创建对应的bean对象,如下所示:

<bean class="org.springframework.jdbc.core.JdbcTemplate">
        <property name="dataSource" ref="dataSource"></property>
</bean>
相关文章
|
Java Maven
MapStruct - Couldn‘t retrieve @Mapper annotation
MapStruct - Couldn‘t retrieve @Mapper annotation
2373 0
|
3月前
Unsatisfied dependency expressed through field 'restTemplate';
Unsatisfied dependency expressed through field 'restTemplate';
79 0
IDEA添加Swagger2:Parameter 0 of method linkDiscoverers in org. springframework hateoas.config.Hateoasconfiguration required a single bean, but 15 were found:
IDEA添加Swagger2:Parameter 0 of method linkDiscoverers in org. springframework hateoas.config.Hateoasconfiguration required a single bean, but 15 were found
|
6月前
Unsatisfied dependency expressed through field ‘baseMapper‘
Unsatisfied dependency expressed through field ‘baseMapper‘
43 2
|
6月前
No qualifying bean of type [com.XX.mapper.SysNameMapper ] found for dependency
No qualifying bean of type [com.XX.mapper.SysNameMapper ] found for dependency
94 0
|
Java Linux 程序员
记录:Unsatisfied dependency expressed through field 'XxxService'...【亲测有效】
记录:Unsatisfied dependency expressed through field 'XxxService'...【亲测有效】
1559 1
|
Java 容器 Spring
No qualifying bean of type或Unsatisfied dependency expressed through field ‘XXXService‘或@Autowired 注入
No qualifying bean of type或Unsatisfied dependency expressed through field ‘XXXService‘或@Autowired 注入
170 0
|
Java 编译器
解决NoSuchBeanDefinitionException: No qualifying bean of type ‘bean.User‘ available
解决NoSuchBeanDefinitionException: No qualifying bean of type ‘bean.User‘ available
180 0
Unsatisfied dependency expressed through field ‘passwordEncoder
Unsatisfied dependency expressed through field ‘passwordEncoder
95 0
Unsatisfied dependency expressed through field ‘passwordEncoder
|
NoSQL Java Redis
Unsatisfied dependency expressed through field /Injection of autowired dependencies failed 解决方法
根据报错的关键字,大底的意思就是依赖方面的问题。
339 0