Hi there,
I'm using a custom AnnotationTransactionAttributeSource to use my custom annotation instead of Spring @Transactional annotation.
I use below BeanFactoryPostProcessor to change original AnnotationTransactionAttributeSource with my own one.
Everything works fine when application context configured withCode:public class CustomTransactionalConfigurer implements BeanFactoryPostProcessor { @Override public void postProcessBeanFactory( ConfigurableListableBeanFactory beanFactory) throws BeansException { String[] beanNames = beanFactory.getBeanNamesForType(AnnotationTransactionAttributeSource.class); for(String beanName : beanNames) { BeanDefinition def = beanFactory.getBeanDefinition(beanName); def.setBeanClassName("com.example.transaction.CustomAnnotationTransactionalAttributeSource"); } }
<tx:annotation-driven transaction-manager="txManager"/>
But I want to enable aspectj mode
<tx:annotation-driven transaction-manager="txManager" mode="aspectj"/>
When I enable aspectj mode getBeansNamesForType method returns an empty list so my custom annotation becomes useless and Spring Transactional annotation starts working since I can not change bean definition.
Any ideas?


Reply With Quote
