这里主要有两个解决思路: mysql未启动,会报这个错误添加两个配置,用于判断一些连接是否有效 spring.datasource.druid.test-on-borrow=true spring.datasource.druid.test-while-idle=true