Spring boot spring boot mybatis检查数据库连接

Spring boot spring boot mybatis检查数据库连接,spring-boot,database-connection,mybatis,Spring Boot,Database Connection,Mybatis,我正在开发一个SpringBoot应用程序,它使用myBatis作为数据库 <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> </dependency> org.mybatis.spring.boot 迈巴蒂斯弹簧靴起动器 有没有可能用某

我正在开发一个SpringBoot应用程序,它使用myBatis作为数据库

<dependency>
    <groupId>org.mybatis.spring.boot</groupId>
    <artifactId>mybatis-spring-boot-starter</artifactId>
</dependency>

org.mybatis.spring.boot
迈巴蒂斯弹簧靴起动器
有没有可能用某种方法或东西来检查DDBB连接是否正常?应用程序内启动,以及每个X ms。 我知道我可以通过检查数据库连接的批处理来完成,例如执行SELECT 1,但可能还有另一种更简单的方法


提前感谢

您是否使用了连接池?如果是,那么在向应用程序发送之前,应该有一种机制来验证连接。不,我不。。。。您建议使用什么作为池连接?例如Hikari?我没有使用Hikari,但它应该支持在获取之前验证连接。请检查此项