I am using the application in two instances that have different database passwords. My code only needs to access and query one instance, and doesn't need to access database on another instance. If I try to deploy the app with wrong password, it gives me "password authentication" error and doesn't start the application.
I want the app to ignore the database connection if password authentication is failed.
Here is my application.properties file.
spring.security.enabled=false
management.security.enabled=false
security.basic.enabled=false
## Postgresql for storing backup details
spring.jpa.hibernate.ddl-auto=update
spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.url= jdbc:postgresql://localhost:5432/dbName
spring.datasource.username=username
spring.datasource.password=password
#spring.datasource.continue-on-error=true
#spring.datasource.initialize=false
spring.jpa.database-platform = org.hibernate.dialect.PostgreSQL94Dialect
spring.datasource.primary.continueOnError=true
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
Spring boot version is 1.5.9
You can run spring boot application without datasource. For that you must disable the auto configuration of datasource and probably the JPA auto configuration as well. Place the below line in your @SpringBootApplication
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class,HibernateJpaAutoConfiguration.class})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With