Announcement Announcement Module
Collapse
No announcement yet.
@EnableAspectJAutoProxy issues Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • @EnableAspectJAutoProxy issues

    When adding @EnableAspectJAutoProxy... get error stating that No matching factory method found transactionAdvisor()


    Configuration class:

    Code:
    @Configuration
    @ComponentScan
    @EnableTransactionManagement
    @EnableAspectJAutoProxy
    public class Configure
    {
       @Bean(name="transactionManager")
       public HibernateTransactionManager hinbernateTransactionManager()
       { .... }
    
       @Bean(name="sessionFactory")
       public SessionFactory sessionFactory()
       { .... }
    
       @Bean
       public AnnotationSessionFactoryBean sessionFactoryBean()
       { .... }
    
       @Bean
       public DataSource dataSource()
       { .... }
    
    }

    Aspect Class:

    Code:
    @Aspect
    @Component
    public AspectedClass
    {
       @Autowired
       private SessionFactory sessionFactory
    
       @Autowired
       private UtilityClass utils
    
       @Around("@target(org.springframework.transaction.annotation.Transactional)")
       public Object invoke(ProceedingJointPoint pjp) throws Throwable
       {
           .... 
           pjp.proceed()
           ....
       }
    }
    Gives me this error
    Code:
    Caused by:org.springframework.beans.factory.BeanCreationException: Error creating bean name with name 'org.springframework.transaction.config.internalTransactionAdvisor' defined in class path resource [org/springframework/transaction/annotation/ProxyTransactionMamagementConfiguration.class]: No matching factory method found: factory bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration#0'; factory method 'transactionAdvisor()'. Check that a method with the specified name exist and that it is non-static.
      at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ContrcutionsResolver.java:528)
    Last edited by arreyf; Apr 17th, 2012, 06:05 PM.

  • #2
    Yesterday I got the exactly same error and it was driving me nuts. The problem is that my pointcut was erroneous and affected Spring classes. Try to use a very specific pointcut, including only one method of one class, for example.

    Comment

    Working...
    X