I have an application written in Spring boot version 2.7.2
and connected to an Oracle database. How can my application still run even if it can't connect to the database (wrong url or dead database)
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.