diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jmx/JmxAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jmx/JmxAutoConfigurationTests.java index 24d5123cde..fa94d1d6d1 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jmx/JmxAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jmx/JmxAutoConfigurationTests.java @@ -20,11 +20,15 @@ import org.junit.After; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; +import org.springframework.beans.DirectFieldAccessor; import org.springframework.beans.factory.NoSuchBeanDefinitionException; +import org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.integration.jmx.config.EnableIntegrationMBeanExport; +import org.springframework.integration.monitor.IntegrationMBeanExporter; import org.springframework.jmx.export.MBeanExporter; import org.springframework.jmx.export.annotation.ManagedAttribute; import org.springframework.jmx.export.annotation.ManagedOperation; @@ -120,6 +124,24 @@ public class JmxAutoConfigurationTests { this.context.refresh(); } + @Test + public void customJmxDomain() { + this.context = new AnnotationConfigApplicationContext(); + this.context.register(CustomJmxDomainConfiguration.class, + JmxAutoConfiguration.class, IntegrationAutoConfiguration.class); + this.context.refresh(); + IntegrationMBeanExporter mbeanExporter = this.context + .getBean(IntegrationMBeanExporter.class); + DirectFieldAccessor dfa = new DirectFieldAccessor(mbeanExporter); + assertEquals("foo.my", dfa.getPropertyValue("domain")); + } + + @Configuration + @EnableIntegrationMBeanExport(defaultDomain = "foo.my") + public static class CustomJmxDomainConfiguration { + + } + @Configuration public static class TestConfiguration {