Problem Description:
Make sure that the annotation @repository is used on the implementation class, and the scanning package is enabled, and a leaf appears next to the class. Click the leaf to jump to the configuration class, that is, the injection should be successful, but an error is always reported during the test no bean named xxxxx available…
Possible causes:
Using @controller, @service, @repository and other annotations, after class annotation, there will be a default bean ID, which is
Class name initial lowercase… If the class name is used during the test, an error will be reported….
Solution:
1. @Repository(“ReaderInfoMapperImpl”)
Specify name
2. Do not use annotation, use < bean> To inject
<bean id="ReaderInfoMapper" class="com.zhx.mapper.ReaderInfoMapperImpl"> <property name="sqlSessionTemplate" ref="sqlSessionTemplate"/> </bean>
Similar Posts:
- Field adminMapper in com.course.service.impl.AdminServiceImpl required a bean of type ‘com.course.mapper.AdminMapper’ that could not be found
- How to Solve Spring Bean Same Name Conflict
- [Solved] Spring introduces the properties variable Error: org.springframework.beans.TypeMismatchException…
- Container Cannot Find bean, Field usersMapper in com.imooc.impl.UserServiceImpl required a bean of type ‘com.imooc.mapper.UsersMapper’ that could not be found.
- org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘com.southwind.mmall002.service.Impl.ProductCategoryServiceImplTest’:
- Solution to the problem of consider defining a bean of type ‘xxx’ in your configuration in spring boot auto injection
- [Solved] SpringbootExpection 1: Error creating bean with name ‘xxxImpl’: Unsatisfied dependency expressed through field
- Two ways to implement Spring Boot’s scanmapper interface class
- Spring cloud uses feignclient to start and report an error
- [Solved] Error creating bean with name ‘orderController’: Unsatisfied dependency expressed through field ‘orderService’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: