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
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
spring.application.admin.jmx-name=org.springframework.boot:type=Admin,name=MultiContextApplication
Main.java is the main class with @SpringConfiguration annotation.
Can anyone please let me know what could be the issue,
Thanks & Regards, Programmer
This github repository exactly what you want to implement. You should only config jmx for each context.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.