报错信息:

2022-07-18 13:30:33,627 main ERROR Could not register mbeans javax.management.InstanceAlreadyExistsException: org.apache.logging.log4j2:type=18b4aac2

解决办法

方法1

发现启动类的入口方法SpringApplication.run方法多次执行了,导致报错。

解决方法:

springboot启动类中只保存一个SpringApplication.run方法;

方法2

我当时发现我有两个application启动类

一个是xxxBootApplication 启动类, 一个是XXXBootTestApplication启动类, 我把上面的XXXBootTestApplication启动类注释掉,再重启项目就好了 .

📂Spring%26SpringBoot - 图1

参考:

https://blog.csdn.net/xumengdi_xmd/article/details/117123643