1

Is it possible to disable the export for MBeans in Spring Integration via a configuration setting?

I'm using Spring Boot with Spring Integration. I've disable JMX in Spring Boot via

endpoints.jmx.enabled: false
spring.jmx.enabled: false

However, I want to see some statistics about some Spring Integration Channels and Enpoints, so I added @EnableIntegration and @EnableIntegrationMBeanExport. I can see the MBeans now.

Is it possible to later disable the export of Spring Integration MBeans via some setting the application.yml (similar to how it is done in Spring Boot)?

matthjes
  • 671
  • 7
  • 20
  • That is already enabled by default so no need to add `@EnableIntegration` or at least the `@EnableIntegrationMBeanExport`. If you want to disable imx just set `spring.jmx.enabled=false` in your property file to completely disable JMX. Your setting only disables the exposure of health and metrics endpoints through JMX. – M. Deinum Mar 08 '17 at 10:40
  • `spring.jmx.enabled` is already set to `false`, but the Spring Integration MBeans are still shown. I've added this info to the questions. – matthjes Mar 08 '17 at 14:13
  • because you are enabling it again by adding `@EnableIntegrationMBeanExport` you are basically bypassing Spring Boot here. As stated remove it and disable imx. – M. Deinum Mar 08 '17 at 14:53
  • Yes, but by removing `@EnableIntegrationMBeanExport` the Spring Integration MBeans no longer get exported, even if I later turn on JMX again using the `spring.jmx.enabled` property. – matthjes Mar 09 '17 at 11:32
  • If you are using Spring Boot auto config that should happen (although I'm not sure which version they added auto config for this). – M. Deinum Mar 09 '17 at 12:13

1 Answers1

2

There is no such a specific property for the Spring Integration JMX. It is fully tied with the common JMX configuration for the whole Boot application.

If you are fine with the @EnableIntegrationMBeanExport, consider to introduce custom @ConfigurationProperties and perform similar @ConditionalOnProperty on that @Configuration which adds that @EnableIntegrationMBeanExport.

Artem Bilan
  • 113,505
  • 11
  • 91
  • 118
  • Ok, I have to define my own property, e.g. `spring.integration.jmx.enable` and then use `@ConditionalOnProperty` to turn the MBeans export on or off. – matthjes Mar 09 '17 at 11:34