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

@ManagedResource not discovered if at least one method is @Transactional, and no exception thrown [SPR-14189] #18760

Open
spring-projects-issues opened this issue Apr 19, 2016 · 2 comments
Labels
in: core type: enhancement

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Apr 19, 2016

teo sarca opened SPR-14189 and commented

Consider following example

@Service
@ManagedResource(...)
public void MyService
{
  @ManagedOperation(....)
   public void myJmxMethod() { ... }

  @Transactional
  public void someOtherTransactionalMethod();
}

This managed resource will not be detected nor registered because in org.springframework.jmx.export.MBeanExporter.autodetect(AutodetectCallback), the call "beanFactory.getType(beanName)" returns "Proxy" class so "callback.include(beanClass, beanName)" will not detect it.

I find this issue critical because it's so easy to break a managed resource that was working just by annotating with @Transactional one of the methods, even if that method is not exposed.


Affects: 4.2.5

Issue Links:

  • #6970 @Transactional annotation hodes @ManagedResource
@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Apr 19, 2016

Juergen Hoeller commented

The solution here is to switch to CGLIB proxies (a.k.a. target-class mode) for your transaction annotation setup. However, point taken that an exception should be raised here; we actually did this in former times but somehow this seems to have been lost. We'll revisit it for 4.3 RC2.

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Nov 7, 2018

mihxil commented

I'm using 5.1.2, and I think this bug is still present. 

@spring-projects-issues spring-projects-issues added type: enhancement in: core labels Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core type: enhancement
Projects
None yet
Development

No branches or pull requests

1 participant