Java Code Examples for org.springframework.transaction.interceptor.TransactionInterceptor#setTransactionManager()
The following examples show how to use
org.springframework.transaction.interceptor.TransactionInterceptor#setTransactionManager() .
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 |
@Bean @Role(BeanDefinition.ROLE_INFRASTRUCTURE) public TransactionInterceptor transactionInterceptor() { TransactionInterceptor interceptor = new TransactionInterceptor(); interceptor.setTransactionAttributeSource(transactionAttributeSource()); if (this.txManager != null) { interceptor.setTransactionManager(this.txManager); } return interceptor; }
Example 2
Source File: SampleTransactionManagementConfiguration.java From spring-boot-graal-feature with Apache License 2.0 | 5 votes |
@Bean @Role(BeanDefinition.ROLE_INFRASTRUCTURE) public TransactionInterceptor transactionInterceptor() { TransactionInterceptor interceptor = new TransactionInterceptor(); interceptor.setTransactionAttributeSource(transactionAttributeSource()); if (this.txManager != null) { interceptor.setTransactionManager(this.txManager); } return interceptor; }
Example 3
Source File: SampleTransactionManagementConfiguration.java From spring-boot-graal-feature with Apache License 2.0 | 5 votes |
@Bean @Role(BeanDefinition.ROLE_INFRASTRUCTURE) public TransactionInterceptor transactionInterceptor() { TransactionInterceptor interceptor = new TransactionInterceptor(); interceptor.setTransactionAttributeSource(transactionAttributeSource()); if (this.txManager != null) { interceptor.setTransactionManager(this.txManager); } return interceptor; }
Example 4
Source File: ProxyTransactionManagementConfiguration.java From spring-analysis-note with MIT License | 5 votes |
@Bean @Role(BeanDefinition.ROLE_INFRASTRUCTURE) public TransactionInterceptor transactionInterceptor() { TransactionInterceptor interceptor = new TransactionInterceptor(); interceptor.setTransactionAttributeSource(transactionAttributeSource()); if (this.txManager != null) { interceptor.setTransactionManager(this.txManager); } return interceptor; }
Example 5
Source File: ProxyTransactionManagementConfiguration.java From java-technology-stack with MIT License | 5 votes |
@Bean @Role(BeanDefinition.ROLE_INFRASTRUCTURE) public TransactionInterceptor transactionInterceptor() { TransactionInterceptor interceptor = new TransactionInterceptor(); interceptor.setTransactionAttributeSource(transactionAttributeSource()); if (this.txManager != null) { interceptor.setTransactionManager(this.txManager); } return interceptor; }
Example 6
Source File: ProxyTransactionManagementConfiguration.java From lams with GNU General Public License v2.0 | 5 votes |
@Bean @Role(BeanDefinition.ROLE_INFRASTRUCTURE) public TransactionInterceptor transactionInterceptor() { TransactionInterceptor interceptor = new TransactionInterceptor(); interceptor.setTransactionAttributeSource(transactionAttributeSource()); if (this.txManager != null) { interceptor.setTransactionManager(this.txManager); } return interceptor; }
Example 7
Source File: ProxyTransactionManagementConfiguration.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Bean @Role(BeanDefinition.ROLE_INFRASTRUCTURE) public TransactionInterceptor transactionInterceptor() { TransactionInterceptor interceptor = new TransactionInterceptor(); interceptor.setTransactionAttributeSource(transactionAttributeSource()); if (this.txManager != null) { interceptor.setTransactionManager(this.txManager); } return interceptor; }
Example 8
Source File: ProgrammaticTransactionConfig.java From spring-boot-cookbook with Apache License 2.0 | 5 votes |
public TransactionInterceptor defaultTransactionInterceptor(PlatformTransactionManager transactionManager, List<Class<? extends Exception>> additionalRollbackRuleExceptions) { TransactionInterceptor transactionInterceptor = new TransactionInterceptor(); Properties transactionAttributes = new Properties(); List<RollbackRuleAttribute> rollbackRules = Lists.newArrayList(); rollbackRules.add(new RollbackRuleAttribute(Exception.class)); //回滚异常 if (additionalRollbackRuleExceptions != null && !additionalRollbackRuleExceptions.isEmpty()) { for (Class<? extends Exception> clazz : additionalRollbackRuleExceptions) { rollbackRules.add(new RollbackRuleAttribute(clazz)); } } DefaultTransactionAttribute readOnlyTransactionAttributes = new DefaultTransactionAttribute(TransactionDefinition.PROPAGATION_REQUIRED); readOnlyTransactionAttributes.setReadOnly(true); RuleBasedTransactionAttribute writeTransactionAttributes = new RuleBasedTransactionAttribute(TransactionDefinition.PROPAGATION_REQUIRED, rollbackRules); String readOnlyTransactionAttributesDefinition = readOnlyTransactionAttributes.toString(); String writeTransactionAttributesDefinition = writeTransactionAttributes.toString(); // read-only transactionAttributes.setProperty("is*", readOnlyTransactionAttributesDefinition); transactionAttributes.setProperty("has*", readOnlyTransactionAttributesDefinition); transactionAttributes.setProperty("get*", readOnlyTransactionAttributesDefinition); transactionAttributes.setProperty("list*", readOnlyTransactionAttributesDefinition); transactionAttributes.setProperty("search*", readOnlyTransactionAttributesDefinition); transactionAttributes.setProperty("find*", readOnlyTransactionAttributesDefinition); transactionAttributes.setProperty("count*", readOnlyTransactionAttributesDefinition); // write et rollback-rule transactionAttributes.setProperty("*", writeTransactionAttributesDefinition); transactionInterceptor.setTransactionAttributes(transactionAttributes); transactionInterceptor.setTransactionManager(this.transactionManager); return transactionInterceptor; }