[英]How to keep Spring boot application running when Oracle connection fails
I have an application written in Spring boot version 2.7.2
and connected to an Oracle database.我有一个用
Spring boot version 2.7.2
编写的应用程序,并连接到 Oracle 数据库。 How can my application still run even if it can't connect to the database (wrong url or dead database)即使无法连接到数据库,我的应用程序如何仍然运行(错误的 url 或死数据库)
spring:
main:
web-application-type: none
log-startup-info: true
profiles:
active: production
sql:
init:
continue-on-error: true
datasource:
url: jdbc:oracle:thin:@127.0.0.1:1521:thanbv
username: thanbv
The application will not be able to run when my database has been shut down.当我的数据库关闭时,应用程序将无法运行。
Failed to obtain JDBC Connection; nested exception is java.sql.SQLException
spring:
sql:
init:
continue-on-error: true
How do I keep my application running regardless of whether the connection is successful with the database?无论与数据库的连接是否成功,如何让我的应用程序保持运行?
@SpringBootApplication(exclude={DataSourceAutoConfiguration.class})
it works for me这个对我有用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.