@Controller是有的,去掉@Transactional是能正常工作的,interface里面也有@Transactional,也是正常的,加到class里就这样了

解决方案 »

  1.   

    testController: @Autowired
    TestService testService;testService:public class TestService{
    @Transactional
    public int insert(){
    ``````
    }
    }
      

  2.   


    加上@Transactional后就注入失败,好像是testController中的@Autowired
    TestService testService;这出的问题
      

  3.   


    @Autowired
             @Qualifier("testController")
    TestService testService;
      

  4.   

    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)}
      

  5.   

    不知道你怎么搞的,你检查一下的配置,你哪里应该注入什么应该自己清楚吧,注解不清楚去查文档。。spring好久没用了我。。