xkcoding / spring-boot-demo

🚀一个用来深入学习并实战 Spring Boot 的项目。
https://parg.co/UZM
MIT License
32.84k stars 10.82k forks source link

[BUG] demo-orm-mybatis-plus 模块启动报错 #255

Open JasperZhan opened 1 year ago

JasperZhan commented 1 year ago

请先看《提问的智慧》,并尝试到 issue 列表 搜寻是否已经有人遇到过同样的问题。


描述问题

demo-orm-mybatis-plus 启动报错,SpringBootDemoHikariCP 在启动时关闭

日志内容
Connected to the target VM, address: '127.0.0.1:54509', transport: 'socket'

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.1.0.RELEASE)

2023-07-07 13:45:05.751  INFO 15828 --- [           main] .SpringBootDemoOrmMybatisPlusApplication : Starting SpringBootDemoOrmMybatisPlusApplication on DESKTOP-IGSU2KM with PID 15828 (D:\code\java\spring-boot-demo\demo-orm-mybatis-plus\target\classes started by erplus in D:\code\java\spring-boot-demo)
2023-07-07 13:45:05.754 DEBUG 15828 --- [           main] .SpringBootDemoOrmMybatisPlusApplication : Running with Spring Boot v2.1.0.RELEASE, Spring v5.1.2.RELEASE
2023-07-07 13:45:05.755  INFO 15828 --- [           main] .SpringBootDemoOrmMybatisPlusApplication : No active profile set, falling back to default profiles: default
2023-07-07 13:45:06.263  INFO 15828 --- [           main] com.zaxxer.hikari.HikariDataSource       : SpringBootDemoHikariCP - Starting...
2023-07-07 13:45:14.894  INFO 15828 --- [           main] com.zaxxer.hikari.HikariDataSource       : SpringBootDemoHikariCP - Start completed.
 _ _   |_  _ _|_. ___ _ |    _ 
| | |\/|_)(_| | |_\  |_)||_|_\ 
     /               |         
                        3.1.0 
2023-07-07 13:45:15.656  INFO 15828 --- [           main] .SpringBootDemoOrmMybatisPlusApplication : Started SpringBootDemoOrmMybatisPlusApplication in 10.18 seconds (JVM running for 10.466)
2023-07-07 13:45:15.659  INFO 15828 --- [       Thread-2] com.zaxxer.hikari.HikariDataSource       : SpringBootDemoHikariCP - Shutdown initiated...
2023-07-07 13:45:16.167  INFO 15828 --- [       Thread-2] com.zaxxer.hikari.HikariDataSource       : SpringBootDemoHikariCP - Shutdown completed.
Disconnected from the target VM, address: '127.0.0.1:54509', transport: 'socket'

Process finished with exit code 0

期待的结果

服务正常启动

截屏或录像

image

其他信息

增加 spring-boot-starter-web 依赖可以解决该问题 参考链接:https://stackoverflow.com/questions/53259267/spring-boot-hikari-pool-shutdown-early-error

JasperZhan commented 1 year ago

已在这个pr修复这个问题 https://github.com/xkcoding/spring-boot-demo/pull/256