org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: cn.test.TestService TestController.testService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [cn.test.TestService ] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true), @org.springframework.beans.factory.annotation.Qualifier(value=AccountController)}
TestService testService;testService:public class TestService{
@Transactional
public int insert(){
``````
}
}
加上@Transactional后就注入失败,好像是testController中的@Autowired
TestService testService;这出的问题
@Autowired
@Qualifier("testController")
TestService testService;