use of org.springframework.transaction.interceptor.BeanFactoryTransactionAttributeSourceAdvisor in project spring-framework by spring-projects.
the class ProxyTransactionManagementConfiguration method transactionAdvisor.
@Bean(name = TransactionManagementConfigUtils.TRANSACTION_ADVISOR_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public BeanFactoryTransactionAttributeSourceAdvisor transactionAdvisor() {
BeanFactoryTransactionAttributeSourceAdvisor advisor = new BeanFactoryTransactionAttributeSourceAdvisor();
advisor.setTransactionAttributeSource(transactionAttributeSource());
advisor.setAdvice(transactionInterceptor());
advisor.setOrder(this.enableTx.<Integer>getNumber("order"));
return advisor;
}
use of org.springframework.transaction.interceptor.BeanFactoryTransactionAttributeSourceAdvisor in project spring-framework by spring-projects.
the class EnableTransactionManagementIntegrationTests method assertTxProxying.
private void assertTxProxying(AnnotationConfigApplicationContext ctx) {
FooRepository repo = ctx.getBean(FooRepository.class);
boolean isTxProxy = false;
if (AopUtils.isAopProxy(repo)) {
for (Advisor advisor : ((Advised) repo).getAdvisors()) {
if (advisor instanceof BeanFactoryTransactionAttributeSourceAdvisor) {
isTxProxy = true;
break;
}
}
}
assertTrue("FooRepository is not a TX proxy", isTxProxy);
// trigger a transaction
repo.findAll();
}
Aggregations