即使数据库关闭,如何使Spring服务器启动?
我正在使用Spring Boot(1.4.7)和MyBatis。
spring.main1.datasource.url=jdbc:mariadb://192.168.0.11:3306/testdb?useUnicode=true&characterEncoding=utf8&autoReconnect=true&socketTimeout=5000&connectTimeout=3000
spring.main1.datasource.username=username
spring.main1.datasource.password=password
spring.main1.datasource.driverClassName=org.mariadb.jdbc.Driver
spring.main1.datasource.tomcat.test-on-borrow=true
spring.main1.datasource.tomcat.test-while-idle=true
spring.main1.datasource.tomcat.validation-query=SELECT 1
spring.main1.datasource.tomcat.validation-query-timeout=5000
spring.main1.datasource.tomcat.validation-interval=5000
spring.main1.datasource.tomcat.max-wait=5000
spring.main1.datasource.continue-on-error=true
当数据库在Eclipse或Linux服务器上断开连接时,我无法启动程序并出现错误。(数据库不在本地主机上。
当我尝试使用断开连接的数据库启动程序时,请打印此内容。
java.sql.SQLNonTransientConnectionException: Could not connect to address=(host=192.168.0.11)(port=3306)(type=master) : connect timed out
Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLNonTransientConnectionException: Could not connect to address=(host=192.168.0.11)(port=3306)(type=master) : connect timed out
Stopping service [Tomcat]
Application startup failed
有什么办法吗?
谢谢