spring-projects / spring-projects/spring-framework

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

Open
#18,760 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

in: core type: enhancement
Dominant language
Java
Stars
60.2k
Forks
38.8k
Avg merge
5d 2h
Merged PRs (30d)
27

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in org.springframework.jmx.export.MBeanExporter.autodetect(AutodetectCallback), where beanFactory.getType(beanName) returns a proxy and callback.include is evaluated. Trace how @ManagedResource and @ManagedOperation discovery handles proxied beans, then verify that adding @Transactional to another method does not prevent registration or raise an exception. The issue does not name a test file.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.