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 @EnableTransactionManagement(proxyTargetClass = true) #5423

Closed
philwebb opened this issue Mar 15, 2016 · 5 comments
Closed

Use @EnableTransactionManagement(proxyTargetClass = true) #5423

philwebb opened this issue Mar 15, 2016 · 5 comments
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@philwebb
Copy link
Member

We should use @EnableTransactionManagement(proxyTargetClass = true) to prevent nasty proxy issues when people aren't using interfaces.

@philwebb philwebb added type: enhancement A general enhancement in-progress labels Mar 15, 2016
@philwebb philwebb self-assigned this Mar 15, 2016
@philwebb philwebb added this to the 1.4.0.M2 milestone Mar 15, 2016
@snicoll
Copy link
Member

snicoll commented Mar 16, 2016

I don't think that's the only one that's involved here. @EnableCaching is in the same camps (and probably others). Do we really want to do that switch unconditionally? Maybe we should improve the error message instead?

@philwebb
Copy link
Member Author

Switching it on by default shouldn't have any side-effects, especially since cglib is repackaged as part of Spring anyway.

@odrotbohm
Copy link
Member

Unfortunately it has :(. See SPR-14322 for details.

@philwebb
Copy link
Member Author

philwebb commented Jun 7, 2016

@olivergierke Looks like SPR-14322 isn't going to be fixed in 4.x. I'm still tempted to leave proxyTargetClass as the new default. Do you think we need to reconsider that decision?

@vipseixas
Copy link

I have a web project that uses Spring and needed to make a batch module for it so I decided to go with Spring Boot and reused my services module from the bigger project. The services module has a ton of final methods and does not go well with cglib and it took me 2 days to understand and fix why cglib proxies where being used despite the fact that all services implemented interfaces.

I also tried changing spring.aop.proxy-target-class in properties but it was ignored (#8434).

It seems to me that changing the default was a bad call. It breaks a well known behavior of Spring.

andersonkyle added a commit to andersonkyle/spring-boot that referenced this issue Aug 31, 2017
This commit documents the change to the default value for
spring.aop.proxy-target-class by clarifying when the default is true vs false.

Fixes spring-projectsgh-5423
andersonkyle added a commit to andersonkyle/spring-boot that referenced this issue Sep 1, 2017
This commit documents the change to the default value for
spring.aop.proxy-target-class by clarifying when the default is true vs
false.

Fixes spring-projectsgh-5423
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

4 participants