title: Spring integration with jmxtrans-agent to monitor bean
body: <p>I am using Spring integration but want to use jmxtrans-agent to monitor my splitter. Like following simple example, I try to count the number of request arrive at splitter.</p>
  
  <pre><code>@ManagedResource
  public class Splitter {
      private final AtomicInteger count = new AtomicInteger();
  
      @ManagedAttribute
      public int getCount(){
          return this.count.get();
      }
  
      public List&lt;JsonNode&gt; split(Message&lt;ArrayNode&gt; message) {
          count.incrementAndGet();
          ...
      }
  }
  
  // spring integration workflow
  &lt;int:gateway id="myGateway" service-interface="someGateway" default-request-channel="splitChannel" error-channel="errorChannel"  default-reply-channel="replyChannel" async-executor="MyThreadPoolTaskExecutor"/&gt;
  
  &lt;int:splitter id="mySplitter" input-channel="splitChannel" output-channel="transformChannel" method="split"&gt;
      &lt;bean class="Splitter" /&gt;
  &lt;/int:splitter&gt;
  
  // in MBeanExporter, I added
  &lt;entry key="myApplication:type=Splitter,name=splitter" value-ref="mySplitter" /&gt;
  
  // query
  &lt;query
      objectName='myApplication:type=Splitter,name=splitter'
      attribute='Count'
      resultAlias='myApplication.Splitter.count'/&gt;
  &lt;collectIntervalInSeconds&gt;20&lt;/collectIntervalInSeconds&gt;
  </code></pre>
  
  <p>I cannot query the data, getting this error.</p>
  
  <pre><code>javax.management.AttributeNotFoundException: getAttribute failed: ModelMBeanAttributeInfo not found for number
      at javax.management.modelmbean.RequiredModelMBean.getAttribute(RequiredModelMBean.java:1524)
      at org.springframework.jmx.export.SpringModelMBean.getAttribute(SpringModelMBean.java:109)
  </code></pre>
  
  <ul>
  <li>Does this splitter has to implement some class to be managed resource?</li>
  <li>I thought spring integration bean scope is per request, if jmxtrans-agent collect information every 20s, is it going to missed the data?</li>
  </ul>