当前使用版本(必填,否则不予处理)
3.5.1
该问题是如何引起的?(确定最新版也有问题再提!!!)
@MybatisPlusTest
class HospitalSetMapperTest {
public HospitalSet entity;
@Autowired
public HospitalSetMapper mapper;
报错信息
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'hospitalController': Unsatisfied dependency expressed through field 'hospitalService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'hospitalServiceImpl': Unsatisfied dependency expressed through field 'repository'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.atguigu.yygh.hosp.repository.HospitalRepository' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
使用了includeFilters后
@MybatisPlusTest(
includeFilters = @ComponentScan.Filter(
type = FilterType.ASSIGNABLE_TYPE,
classes = HospitalSetMapper.class
)
)
class HospitalSetMapperTest {
@Autowired
public HospitalSetMapper mapper;
还是会导入controller,报错信息
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'hospitalController': Unsatisfied dependency expressed through field 'hospitalService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'hospitalServiceImpl': Unsatisfied dependency expressed through field 'repository'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.atguigu.yygh.hosp.repository.HospitalRepository' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
Comment From: miemieYaho
抄的MybatisTest去问他们