I am using mongodb in my spring boot application with below configuration.
spring:
data:
mongodb:
authentication-database: admin
database: log
username: ${MONGO_DATASOURCE_USERNAME}
password: ${MONGO_DATASOURCE_PASSWORD}
When my mongodb is up and running, Everything works fine.
But when i deploy this on Jenkins (Where mongodb is not installed), I have observed weird behaviour that my spring application is trying to connect mongodb at every second which makes my app startup time huge.
Similar scenario i have with my Postgres database as well (No postgres on Jenkins, Still my application should start without failing), But in that i am able to skip the postgres or start the app even though we have error with postgres by using
constinue-on-error: true
property in my yaml's datasource tag file.
Is there anything that i can do for mongodb?
My spring boot application should start even though we don't have mongodb.
I tried below code but it didn't worked.
@SpringBootApplication(exclude = {
MongoAutoConfiguration.class,
MongoDataAutoConfiguration.class
})
Thanks!