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

Provide means to opt out of default annotation based transaction management by bean [SPR-13109] #17700

Closed
spring-projects-issues opened this issue Jun 10, 2015 · 4 comments

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Jun 10, 2015

Oliver Drotbohm opened SPR-13109 and commented

Spring Data JPA repositories create proxies that already apply custom transaction handling to it's beans. The proxy is exposing interfaces that might contain @Transactional annotations. This causes the proxy being rewrapped into yet another proxy in case @EnableTransactionManagement is activated. This causes the default transaction attribute lookup to be used for transactions instead of our customized one cause it's hidden inside the nested proxy.

It would be cool if the proxy we create could expose some kind of marker interface (Jürgen suggested GoAway :D ) that would cause the pointcut not to match and thus avoid the default transaction interceptor to be deployed in the outer proxy.


Affects: 4.1.6, 4.2 RC1

Issue Links:

  • DATACMNS-715 @Transactional customizations not applied correctly on redeclared methods ("is depended on by")
  • DATAJPA-755 Overriding @Transactional on repository method not working

Referenced from: commits 9f64230, c85127d

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jun 17, 2015

Juergen Hoeller commented

I'm about to commit this to master, with a TransactionalProxy marker interface (extending our existing SpringProxy marker) detected by TransactionAttributeSourcePointcut, with the metadata-driven pointcut never matching in that case. This is also meant to be backported to 4.1.7.

In addition, TransactionProxyFactoryBean exposes the TransactionalProxy marker now, allowing it to co-exist with (descriptive) @Transactional annotations on the same interface which are not meant to take effect for auto-proxying. This is basically the same case that Spring Data has as well. However, I'm only going to commit this part for 4.2, since it may have subtle effects for existing TransactionProxyFactoryBean usage.

Juergen

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jun 17, 2015

Juergen Hoeller commented

This is in master now. Feel free to give it a try, Oliver Drotbohm... I'll backport to 4.1.7 later today.

Juergen

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jun 17, 2015

Juergen Hoeller commented

Oliver Drotbohm, the essence of this (see above) is available in the latest 4.1.7 snapshot as well now.

Let me know whether it works for your purposes...

Juergen

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jun 17, 2015

Oliver Drotbohm commented

I've put the support in place in all the currently maintained branches (see master here and see this fixing the issue in an integrating test case. Thanks for the quick turnaround!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants