SpringBoot启动抛出Unregistering JMX-exposed beans on shutdown异常

在配置 SpringBoot 项目时可能会抛出 Unregistering JMX-exposed beans on shutdown异常

抛出错误的原因

  1. 是因为以下依赖的 scope 为 provided 导致的
1
2
3
4
5
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-tomcat</artifactId>
    <scope>provided</scope>
</dependency>

解决的办法

  1. provided 改为 compile 即可
1
2
3
4
5
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-tomcat</artifactId>
    <scope>compile</scope>
</dependency>