[英]Spring Boot - Multiple Contexts “Error creating bean with name 'springApplicationAdminRegistrar' defined in class path resource”
I have created basic spring boot application for trying out multiple contexts, and here is the source code here 我已经创建了基本的春天启动应用尝试多个上下文,这里是源代码在这里
The structure of the application is : 该应用程序的结构为:
The code runs fine, with just one child, the moment i add the "webapp" application context, it gives the below error 当我添加“ webapp”应用程序上下文时,代码只有一个孩子,运行良好,它给出以下错误
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springApplicationAdminRegistrar' defined in class path resource [org/springframework/boot/autoconfigure/admin/SpringApplicationAdminJmxAutoConfiguration.class]: Invocation of init method failed; nested exception is javax.management.InstanceAlreadyExistsException: org.springframework.boot:type=Admin,name=MultiContextApplication
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1706) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:579) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
Where "MultiContextApplication" is the application jmx-name provided in the application.properties file as 其中“ MultiContextApplication”是application.properties文件中提供的应用程序jmx名称,如下所示:
spring.application.admin.jmx-name=org.springframework.boot:type=Admin,name=MultiContextApplication
Main.java is the main class with @SpringConfiguration annotation. Main.java是带有@SpringConfiguration批注的主类。
Can anyone please let me know what could be the issue, 谁能让我知道可能是什么问题,
Thanks & Regards, Programmer 谢谢与问候,程序员
This github repository exactly what you want to implement. 这个github仓库正是您要实现的。 You should only config jmx for each context. 您只应为每个上下文配置jmx。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.