Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use proxyBeanMethods=false in ProxyTransactionManagementConfiguration #23166

Closed
dsyer opened this issue Jun 20, 2019 · 1 comment
Closed

Use proxyBeanMethods=false in ProxyTransactionManagementConfiguration #23166

dsyer opened this issue Jun 20, 2019 · 1 comment
Assignees
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: task A general task
Milestone

Comments

@dsyer
Copy link
Member

dsyer commented Jun 20, 2019

Like in #23004 I find that ProxyTransactionManagementConfiguration probably could (should?) use proxyBeanMethods but doesn't.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jun 20, 2019
@dsyer
Copy link
Member Author

dsyer commented Jun 20, 2019

FWIW I tried this in a Spring Boot app and it seems to work:

@Configuration(proxyBeanMethods = false)
public class SampleTransactionManagementConfiguration
		extends AbstractTransactionManagementConfiguration {

	@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;
	}

	@Bean
	@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
	public TransactionAttributeSource transactionAttributeSource() {
		return new AnnotationTransactionAttributeSource();
	}

	@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;
	}
}

@sdeleuze sdeleuze self-assigned this Jul 10, 2019
@sdeleuze sdeleuze added this to the 5.2 RC1 milestone Jul 10, 2019
@sdeleuze sdeleuze added in: core Issues in core modules (aop, beans, core, context, expression) type: task A general task and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jul 10, 2019
@jhoeller jhoeller added in: data Issues in data modules (jdbc, orm, oxm, tx) and removed in: core Issues in core modules (aop, beans, core, context, expression) labels Feb 12, 2020
@jhoeller jhoeller changed the title Use proxyBeanMethods in ProxyTransactionManagementConfiguration Use proxyBeanMethods=false in ProxyTransactionManagementConfiguration Feb 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: task A general task
Projects
None yet
Development

No branches or pull requests

4 participants