springboot项目没有报错,然后启动完成后接着就平滑关闭了 日志最后一行打印如下
[extShutdownHook] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@82df6a, started
解决方法: 找到pom.xml文件
找到
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope> </dependency>
将其改为
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> </dependency>
即可解决这个问题
本文解决了一个SpringBoot项目启动后立即平滑关闭的问题,通过调整pom.xml中spring-boot-starter-tomcat依赖的scope属性从provided改为默认,成功避免了项目的异常关闭。
3587

被折叠的 条评论
为什么被折叠?



