How can Spring WebSocketMessageBrokerStats be exposed via JMX using MBeanExporter
<p>Spring documentation say that when you use the @EnableWebSocketMessageBroker annotation, one bean of type WebSocketMessageBrokerStats es created. This bean can be exported to JMX through Spring’s MBeanExporter for viewing at runtime, for example through JDK’s jconsole (or VisualVM). I don't know how create the Mbean.</p>

<p><a href="http://docs.spring.io/spring/docs/current/spring-framework-reference/html/websocket.html#websocket-stomp-stats" rel="nofollow noreferrer">http://docs.spring.io/spring/docs/current/spring-framework-reference/html/websocket.html#websocket-stomp-stats</a></p>

<p>I found that <code>@EnableMBeanExport</code> is equivalent to use <code>&lt;context:mbean-export&gt;</code></p>

<p>In another stackoverflow link I found that I need do some similar to the next:</p>

<pre><code>@Configuration
@EnableMBeanExport

    public class SpringConfiguration {
       @Bean
       protected CountingHttpInterceptor countingHttpInterceptor() {
          return new CountingHttpInterceptor();
       }
    }
</code></pre>

<p><a href="https://stackoverflow.com/questions/3133106/exporting-spring-bean-objects-using-jmx">Exporting Spring @Bean objects using JMX</a></p>

<p>then I supposed that I need declare a bean as next:</p>

<pre><code>@Configuration
@EnableMBeanExport
public class SpringConfiguration {

       @Bean
       protected WebSocketMessageBrokerStats webSocketMessageBrokerStats() {
           return new WebSocketMessageBrokerStats();
       }
 }
</code></pre>

<p>but this don't worked.</p>

<p>I found that I need enable JMX in the JVM too.
I'm using WildFly 9.0 as webapplication server.  I need enable the JMX to WebSocketMessageBrokerStats can work?</p>

<p>Actually I have a STOMP over Websocket implementation using Spring Framework 4.3.2. An Websocket WebSocketMessageBrokerStats show me the stats bean show information each 30 minutes in the console.</p>

<p>The unique place that I found some code using this Object is a Websocket Chat, but I don't understand how use it in the example.</p>

<p><a href="https://github.com/salmar/spring-websocket-chat" rel="nofollow noreferrer">https://github.com/salmar/spring-websocket-chat</a></p>

<p>Thanks. </p>