org.springframework.transaction.config.TransactionManagementConfigUtils Java Examples

The following examples show how to use org.springframework.transaction.config.TransactionManagementConfigUtils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SampleTransactionManagementConfiguration.java    From spring-boot-graal-feature with Apache License 2.0 5 votes vote down vote up
@Bean(name = TransactionManagementConfigUtils.TRANSACTION_ADVISOR_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public BeanFactoryTransactionAttributeSourceAdvisor transactionAdvisor(
		TransactionAttributeSource transactionAttributeSource, TransactionInterceptor transactionInterceptor) {
	BeanFactoryTransactionAttributeSourceAdvisor advisor = new BeanFactoryTransactionAttributeSourceAdvisor();
	advisor.setTransactionAttributeSource(transactionAttributeSource);
	advisor.setAdvice(transactionInterceptor);
	if (this.enableTx != null) {
		advisor.setOrder(this.enableTx.<Integer>getNumber("order"));
	}
	return advisor;
}
 
Example #2
Source File: AspectJTransactionManagementConfiguration.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Bean(name = TransactionManagementConfigUtils.TRANSACTION_ASPECT_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public AnnotationTransactionAspect transactionAspect() {
	AnnotationTransactionAspect txAspect = AnnotationTransactionAspect.aspectOf();
	if (this.txManager != null) {
		txAspect.setTransactionManager(this.txManager);
	}
	return txAspect;
}
 
Example #3
Source File: EnableTransactionManagementTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void transactionalEventListenerRegisteredProperly() {
	AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(EnableTxConfig.class);
	assertTrue(ctx.containsBean(TransactionManagementConfigUtils.TRANSACTIONAL_EVENT_LISTENER_FACTORY_BEAN_NAME));
	assertEquals(1, ctx.getBeansOfType(TransactionalEventListenerFactory.class).size());
	ctx.close();
}
 
Example #4
Source File: ProxyTransactionManagementConfiguration.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example #5
Source File: TransactionManagementConfigurationSelector.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 * @return {@link ProxyTransactionManagementConfiguration} or
 * {@code AspectJTransactionManagementConfiguration} for {@code PROXY} and
 * {@code ASPECTJ} values of {@link EnableTransactionManagement#mode()}, respectively
 */
@Override
protected String[] selectImports(AdviceMode adviceMode) {
	switch (adviceMode) {
		case PROXY:
			return new String[] {AutoProxyRegistrar.class.getName(), ProxyTransactionManagementConfiguration.class.getName()};
		case ASPECTJ:
			return new String[] {TransactionManagementConfigUtils.TRANSACTION_ASPECT_CONFIGURATION_CLASS_NAME};
		default:
			return null;
	}
}
 
Example #6
Source File: ProxyTransactionManagementConfiguration.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@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;
}
 
Example #7
Source File: TransactionManagementConfigurationSelector.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 * @return {@link ProxyTransactionManagementConfiguration} or
 * {@code AspectJTransactionManagementConfiguration} for {@code PROXY} and
 * {@code ASPECTJ} values of {@link EnableTransactionManagement#mode()}, respectively
 */
@Override
protected String[] selectImports(AdviceMode adviceMode) {
	switch (adviceMode) {
		case PROXY:
			return new String[] {AutoProxyRegistrar.class.getName(), ProxyTransactionManagementConfiguration.class.getName()};
		case ASPECTJ:
			return new String[] {TransactionManagementConfigUtils.TRANSACTION_ASPECT_CONFIGURATION_CLASS_NAME};
		default:
			return null;
	}
}
 
Example #8
Source File: AspectJTransactionManagementConfiguration.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Bean(name = TransactionManagementConfigUtils.TRANSACTION_ASPECT_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public AnnotationTransactionAspect transactionAspect() {
	AnnotationTransactionAspect txAspect = AnnotationTransactionAspect.aspectOf();
	if (this.txManager != null) {
		txAspect.setTransactionManager(this.txManager);
	}
	return txAspect;
}
 
Example #9
Source File: AspectJJtaTransactionManagementConfiguration.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Bean(name = TransactionManagementConfigUtils.JTA_TRANSACTION_ASPECT_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public JtaAnnotationTransactionAspect jtaTransactionAspect() {
	JtaAnnotationTransactionAspect txAspect = JtaAnnotationTransactionAspect.aspectOf();
	if (this.txManager != null) {
		txAspect.setTransactionManager(this.txManager);
	}
	return txAspect;
}
 
Example #10
Source File: EnableTransactionManagementTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void transactionalEventListenerRegisteredProperly() {
	AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(EnableTxConfig.class);
	assertTrue(ctx.containsBean(TransactionManagementConfigUtils.TRANSACTIONAL_EVENT_LISTENER_FACTORY_BEAN_NAME));
	assertEquals(1, ctx.getBeansOfType(TransactionalEventListenerFactory.class).size());
	ctx.close();
}
 
Example #11
Source File: ProxyTransactionManagementConfiguration.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Bean(name = TransactionManagementConfigUtils.TRANSACTION_ADVISOR_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public BeanFactoryTransactionAttributeSourceAdvisor transactionAdvisor() {
	BeanFactoryTransactionAttributeSourceAdvisor advisor = new BeanFactoryTransactionAttributeSourceAdvisor();
	advisor.setTransactionAttributeSource(transactionAttributeSource());
	advisor.setAdvice(transactionInterceptor());
	if (this.enableTx != null) {
		advisor.setOrder(this.enableTx.<Integer>getNumber("order"));
	}
	return advisor;
}
 
Example #12
Source File: AspectJTransactionManagementConfiguration.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Bean(name = TransactionManagementConfigUtils.TRANSACTION_ASPECT_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public AnnotationTransactionAspect transactionAspect() {
	AnnotationTransactionAspect txAspect = AnnotationTransactionAspect.aspectOf();
	if (this.txManager != null) {
		txAspect.setTransactionManager(this.txManager);
	}
	return txAspect;
}
 
Example #13
Source File: AspectJJtaTransactionManagementConfiguration.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Bean(name = TransactionManagementConfigUtils.JTA_TRANSACTION_ASPECT_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public JtaAnnotationTransactionAspect jtaTransactionAspect() {
	JtaAnnotationTransactionAspect txAspect = JtaAnnotationTransactionAspect.aspectOf();
	if (this.txManager != null) {
		txAspect.setTransactionManager(this.txManager);
	}
	return txAspect;
}
 
Example #14
Source File: EnableTransactionManagementTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void transactionalEventListenerRegisteredProperly() {
	AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(EnableTxConfig.class);
	assertTrue(ctx.containsBean(TransactionManagementConfigUtils.TRANSACTIONAL_EVENT_LISTENER_FACTORY_BEAN_NAME));
	assertEquals(1, ctx.getBeansOfType(TransactionalEventListenerFactory.class).size());
	ctx.close();
}
 
Example #15
Source File: ProxyTransactionManagementConfiguration.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Bean(name = TransactionManagementConfigUtils.TRANSACTION_ADVISOR_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public BeanFactoryTransactionAttributeSourceAdvisor transactionAdvisor() {
	BeanFactoryTransactionAttributeSourceAdvisor advisor = new BeanFactoryTransactionAttributeSourceAdvisor();
	advisor.setTransactionAttributeSource(transactionAttributeSource());
	advisor.setAdvice(transactionInterceptor());
	if (this.enableTx != null) {
		advisor.setOrder(this.enableTx.<Integer>getNumber("order"));
	}
	return advisor;
}
 
Example #16
Source File: SampleTransactionManagementConfiguration.java    From spring-boot-graal-feature with Apache License 2.0 5 votes vote down vote up
@Bean(name = TransactionManagementConfigUtils.TRANSACTION_ADVISOR_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public BeanFactoryTransactionAttributeSourceAdvisor transactionAdvisor(
		TransactionAttributeSource transactionAttributeSource,
		TransactionInterceptor transactionInterceptor) {
	BeanFactoryTransactionAttributeSourceAdvisor advisor = new BeanFactoryTransactionAttributeSourceAdvisor();
	advisor.setTransactionAttributeSource(transactionAttributeSource);
	advisor.setAdvice(transactionInterceptor);
	if (this.enableTx != null) {
		advisor.setOrder(this.enableTx.<Integer>getNumber("order"));
	}
	return advisor;
}
 
Example #17
Source File: SampleTransactionManagementConfiguration.java    From spring-boot-graal-feature with Apache License 2.0 5 votes vote down vote up
@Bean(name = TransactionManagementConfigUtils.TRANSACTION_ADVISOR_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public BeanFactoryTransactionAttributeSourceAdvisor transactionAdvisor(
		TransactionAttributeSource transactionAttributeSource, TransactionInterceptor transactionInterceptor) {
	BeanFactoryTransactionAttributeSourceAdvisor advisor = new BeanFactoryTransactionAttributeSourceAdvisor();
	advisor.setTransactionAttributeSource(transactionAttributeSource);
	advisor.setAdvice(transactionInterceptor);
	if (this.enableTx != null) {
		advisor.setOrder(this.enableTx.<Integer>getNumber("order"));
	}
	return advisor;
}
 
Example #18
Source File: TransactionManagementConfigurationSelector.java    From java-technology-stack with MIT License 4 votes vote down vote up
private String determineTransactionAspectClass() {
	return (ClassUtils.isPresent("javax.transaction.Transactional", getClass().getClassLoader()) ?
			TransactionManagementConfigUtils.JTA_TRANSACTION_ASPECT_CONFIGURATION_CLASS_NAME :
			TransactionManagementConfigUtils.TRANSACTION_ASPECT_CONFIGURATION_CLASS_NAME);
}
 
Example #19
Source File: AbstractTransactionManagementConfiguration.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Bean(name = TransactionManagementConfigUtils.TRANSACTIONAL_EVENT_LISTENER_FACTORY_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public static TransactionalEventListenerFactory transactionalEventListenerFactory() {
	return new TransactionalEventListenerFactory();
}
 
Example #20
Source File: AnnotationTransactionNamespaceHandlerTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Test
public void transactionalEventListenerRegisteredProperly() {
	assertTrue(this.context.containsBean(TransactionManagementConfigUtils
			.TRANSACTIONAL_EVENT_LISTENER_FACTORY_BEAN_NAME));
	assertEquals(1, this.context.getBeansOfType(TransactionalEventListenerFactory.class).size());
}
 
Example #21
Source File: AnnotationTransactionNamespaceHandlerTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Test
public void transactionalEventListenerRegisteredProperly() {
	assertTrue(this.context.containsBean(TransactionManagementConfigUtils
			.TRANSACTIONAL_EVENT_LISTENER_FACTORY_BEAN_NAME));
	assertEquals(1, this.context.getBeansOfType(TransactionalEventListenerFactory.class).size());
}
 
Example #22
Source File: AbstractTransactionManagementConfiguration.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Bean(name = TransactionManagementConfigUtils.TRANSACTIONAL_EVENT_LISTENER_FACTORY_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public static TransactionalEventListenerFactory transactionalEventListenerFactory() {
	return new TransactionalEventListenerFactory();
}
 
Example #23
Source File: AbstractTransactionManagementConfiguration.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Bean(name = TransactionManagementConfigUtils.TRANSACTIONAL_EVENT_LISTENER_FACTORY_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public TransactionalEventListenerFactory transactionalEventListenerFactory() {
	return new TransactionalEventListenerFactory();
}
 
Example #24
Source File: TransactionManagementConfigurationSelector.java    From spring-analysis-note with MIT License 4 votes vote down vote up
private String determineTransactionAspectClass() {
	return (ClassUtils.isPresent("javax.transaction.Transactional", getClass().getClassLoader()) ?
			TransactionManagementConfigUtils.JTA_TRANSACTION_ASPECT_CONFIGURATION_CLASS_NAME :
			TransactionManagementConfigUtils.TRANSACTION_ASPECT_CONFIGURATION_CLASS_NAME);
}
 
Example #25
Source File: AbstractTransactionManagementConfiguration.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Bean(name = TransactionManagementConfigUtils.TRANSACTIONAL_EVENT_LISTENER_FACTORY_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public TransactionalEventListenerFactory transactionalEventListenerFactory() {
	return new TransactionalEventListenerFactory();
}
 
Example #26
Source File: AnnotationTransactionNamespaceHandlerTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Test
public void transactionalEventListenerRegisteredProperly() {
	assertTrue(this.context.containsBean(TransactionManagementConfigUtils
			.TRANSACTIONAL_EVENT_LISTENER_FACTORY_BEAN_NAME));
	assertEquals(1, this.context.getBeansOfType(TransactionalEventListenerFactory.class).size());
}