简体   繁体   English

Spring Boot-多个上下文“在类路径资源中创建名称为'springApplicationAdminRegistrar'的bean时出错”

[英]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 : 该应用程序的结构为:

  • One main "root" context 一个主要的“根”上下文
  • Two children contexts "api" ,"webapp" 两个孩子上下文“ api”,“ webapp”

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.

相关问题 Spring Boot:+ Spring Data Rest:创建类路径资源中定义的名称为'entityManagerFactory'的bean时出错 - Spring Boot: + Spring Data Rest: Error creating bean with name 'entityManagerFactory' defined in class path resource Spring Boot和PostgreSQL:在类路径资源中定义名为'entityManagerFactory'的bean时出错 - Spring Boot and PostgreSQL : Error creating bean with name 'entityManagerFactory' defined in class path resource 使用spring boot时,在类路径资源中定义名为“entityManagerFactory”的bean时出错 - Error creating bean with name 'entityManagerFactory' defined in class path resource while using spring boot 我为我的 spring 启动应用程序收到在 class 路径资源中定义的名称为 'requestMappingHandlerAdapter' 的创建 bean 时出错 - I get the 'Error creating bean with name 'requestMappingHandlerAdapter' defined in class path resource' for my spring boot application Spring 引导 - 创建名称为“dataSource”的 bean 在 class 路径资源中定义时出错 - Spring Boot - Error creating bean with name 'dataSource' defined in class path resource 春季:创建类路径资源中定义的名称为'entityManagerFactory'的bean时出错 - Spring : Error creating bean with name 'entityManagerFactory' defined in class path resource 在 class 路径资源 [net/rakugakibox/spring/boot/orika/OrikaAutoConfiguration.class] 中定义名称为“orikaMapperFacade”的 bean 创建错误 - Error creating bean with name 'orikaMapperFacade' defined in class path resource [net/rakugakibox/spring/boot/orika/OrikaAutoConfiguration.class] 创建名称为springApplicationAdminRegistrar的bean时出错 - Error creating bean with name springApplicationAdminRegistrar 创建名为“springApplicationAdminRegistrar”的 bean 时出错: - Error creating bean with name 'springApplicationAdminRegistrar': Spring 安全性 - 过滤器链错误 - 在 class 路径资源中定义名称为“filterChain”的 bean 创建错误 - Spring Security - Filter Chain Error - Error creating bean with name 'filterChain' defined in class path resource
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM