Skip to content

Use @EnableTransactionManagement(proxyTargetClass = true) #5423

Closed

Description

@philwebb

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

Activity

  1. self-assigned this
    on Mar 15, 2016
  2. added this to the 1.4.0.M2 milestone on Mar 15, 2016
  3. snicoll commented on Mar 16, 2016

    @snicoll
    Member

    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?

  4. philwebb commented on Mar 29, 2016

    @philwebb
    MemberAuthor

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

  5. odrotbohm commented on May 31, 2016

    @odrotbohm
    Member

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

  6. philwebb commented on Jun 7, 2016

    @philwebb
    MemberAuthor

    @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?

  7. vinisxs commented on Mar 29, 2017

    @vinisxs

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

type: enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions