@@ -29,7 +29,6 @@ import org.springframework.core.type.AnnotationMetadata;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.config.TransactionManagementConfigUtils;
|
||||
import org.springframework.transaction.event.TransactionalEventListenerFactory;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
/**
|
||||
@@ -52,18 +51,14 @@ public abstract class AbstractTransactionManagementConfiguration implements Impo
|
||||
protected PlatformTransactionManager txManager;
|
||||
|
||||
|
||||
@Bean(name = TransactionManagementConfigUtils.TRANSACTIONAL_EVENT_LISTENER_FACTORY_BEAN_NAME)
|
||||
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
||||
public TransactionalEventListenerFactory transactionalEventListenerFactory() {
|
||||
return new TransactionalEventListenerFactory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setImportMetadata(AnnotationMetadata importMetadata) {
|
||||
this.enableTx = AnnotationAttributes.fromMap(
|
||||
importMetadata.getAnnotationAttributes(EnableTransactionManagement.class.getName(), false));
|
||||
Assert.notNull(this.enableTx,
|
||||
"@EnableTransactionManagement is not present on importing class " + importMetadata.getClassName());
|
||||
if (this.enableTx == null) {
|
||||
throw new IllegalArgumentException(
|
||||
"@EnableTransactionManagement is not present on importing class " + importMetadata.getClassName());
|
||||
}
|
||||
}
|
||||
|
||||
@Autowired(required = false)
|
||||
@@ -78,4 +73,11 @@ public abstract class AbstractTransactionManagementConfiguration implements Impo
|
||||
this.txManager = configurer.annotationDrivenTransactionManager();
|
||||
}
|
||||
|
||||
|
||||
@Bean(name = TransactionManagementConfigUtils.TRANSACTIONAL_EVENT_LISTENER_FACTORY_BEAN_NAME)
|
||||
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
||||
public TransactionalEventListenerFactory transactionalEventListenerFactory() {
|
||||
return new TransactionalEventListenerFactory();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user