{"action":"created","issue":{"url":"https://api.github.com/repos/spring-projects/spring-boot/issues/5682","repository_url":"https://api.github.com/repos/spring-projects/spring-boot","labels_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/5682/labels{/name}","comments_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/5682/comments","events_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/5682/events","html_url":"https://github.com/spring-projects/spring-boot/issues/5682","id":148128942,"number":5682,"title":"Multiple MBeanExporter are created","user":{"login":"romainmoreau","id":1763676,"avatar_url":"https://avatars.githubusercontent.com/u/1763676?v=3","gravatar_id":"","url":"https://api.github.com/users/romainmoreau","html_url":"https://github.com/romainmoreau","followers_url":"https://api.github.com/users/romainmoreau/followers","following_url":"https://api.github.com/users/romainmoreau/following{/other_user}","gists_url":"https://api.github.com/users/romainmoreau/gists{/gist_id}","starred_url":"https://api.github.com/users/romainmoreau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/romainmoreau/subscriptions","organizations_url":"https://api.github.com/users/romainmoreau/orgs","repos_url":"https://api.github.com/users/romainmoreau/repos","events_url":"https://api.github.com/users/romainmoreau/events{/privacy}","received_events_url":"https://api.github.com/users/romainmoreau/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/spring-projects/spring-boot/labels/invalid","name":"invalid","color":"e6e6e6"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-04-13T17:30:22Z","updated_at":"2016-07-07T09:27:38Z","closed_at":"2016-04-14T07:44:58Z","body":"Here are three Spring Boot parts that are relying on JMX:\r\n- the `spring-boot-starter-actuator` dependency;\r\n- the `@EnableMBeanExport` annotation;\r\n- a Spring Boot App profile to launch the application from Eclipse using Spring Tool Suite 3.7.3.RELEASE.\r\n\r\nWhen these three parts are used together with Spring Boot 1.4.0.M2, the application fails to start:\r\n\r\n```\r\n2016-04-13 19:22:51.399 ERROR 3748 --- [           main] o.s.boot.SpringApplication               : Application startup failed\r\n\r\norg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration$$EnhancerBySpringCGLIB$$5b336419]: Constructor threw exception; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [org.springframework.jmx.export.MBeanExporter] is defined: expected single matching bean but found 2: mbeanExporter,endpointMBeanExporter\r\n\tat org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:279) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1]\r\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1143) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1]\r\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1046) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1]\r\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1]\r\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1]\r\n\tat org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1]\r\n\tat org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1]\r\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1]\r\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1]\r\n\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:775) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1]\r\n\tat org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:841) ~[spring-context-4.3.0.RC1.jar:4.3.0.RC1]\r\n\tat org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:540) ~[spring-context-4.3.0.RC1.jar:4.3.0.RC1]\r\n\tat org.springframework.boot.SpringApplication.refresh(SpringApplication.java:765) [spring-boot-1.4.0.M2.jar:1.4.0.M2]\r\n\tat org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) [spring-boot-1.4.0.M2.jar:1.4.0.M2]\r\n\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:314) [spring-boot-1.4.0.M2.jar:1.4.0.M2]\r\n\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:1182) [spring-boot-1.4.0.M2.jar:1.4.0.M2]\r\n\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:1171) [spring-boot-1.4.0.M2.jar:1.4.0.M2]\r\n\tat fr.romainmoreau.JmxReproApplication.main(JmxReproApplication.java:11) [classes/:na]\r\nCaused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration$$EnhancerBySpringCGLIB$$5b336419]: Constructor threw exception; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [org.springframework.jmx.export.MBeanExporter] is defined: expected single matching bean but found 2: mbeanExporter,endpointMBeanExporter\r\n\tat org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:163) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1]\r\n\tat org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:122) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1]\r\n\tat org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:271) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1]\r\n\t... 17 common frames omitted\r\nCaused by: org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [org.springframework.jmx.export.MBeanExporter] is defined: expected single matching bean but found 2: mbeanExporter,endpointMBeanExporter\r\n\tat org.springframework.beans.factory.config.DependencyDescriptor.resolveNotUnique(DependencyDescriptor.java:172) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1]\r\n\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1059) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1]\r\n\tat org.springframework.beans.factory.support.DefaultListableBeanFactory$DependencyObjectProvider.getIfAvailable(DefaultListableBeanFactory.java:1544) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1]\r\n\tat org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration.<init>(SpringApplicationAdminJmxAutoConfiguration.java:63) ~[spring-boot-autoconfigure-1.4.0.M2.jar:1.4.0.M2]\r\n\tat org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration$$EnhancerBySpringCGLIB$$5b336419.<init>(<generated>) ~[spring-boot-autoconfigure-1.4.0.M2.jar:1.4.0.M2]\r\n\tat sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_77]\r\n\tat sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_77]\r\n\tat sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_77]\r\n\tat java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_77]\r\n\tat org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1]\r\n\t... 19 common frames omitted\r\n```\r\n\r\nA workaround is to simply not use one of these parts.\r\nWith Spring Boot 1.3.3 or 1.4.0.M1, there is no issue.\r\n\r\nHere's a reproduction project: https://github.com/romainmoreau/jmx-repro"},"comment":{"url":"https://api.github.com/repos/spring-projects/spring-boot/issues/comments/231028667","html_url":"https://github.com/spring-projects/spring-boot/issues/5682#issuecomment-231028667","issue_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/5682","id":231028667,"user":{"login":"snicoll","id":490484,"avatar_url":"https://avatars.githubusercontent.com/u/490484?v=3","gravatar_id":"","url":"https://api.github.com/users/snicoll","html_url":"https://github.com/snicoll","followers_url":"https://api.github.com/users/snicoll/followers","following_url":"https://api.github.com/users/snicoll/following{/other_user}","gists_url":"https://api.github.com/users/snicoll/gists{/gist_id}","starred_url":"https://api.github.com/users/snicoll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snicoll/subscriptions","organizations_url":"https://api.github.com/users/snicoll/orgs","repos_url":"https://api.github.com/users/snicoll/repos","events_url":"https://api.github.com/users/snicoll/events{/privacy}","received_events_url":"https://api.github.com/users/snicoll/received_events","type":"User","site_admin":false},"created_at":"2016-07-07T09:27:38Z","updated_at":"2016-07-07T09:27:38Z","body":"Isn't that #6328 anyway?"}}
{"actor":{"display_login":"snicoll"}}