How AI is applied across API Evangelist and APIs.io. Read my AI disclosure →
API Evangelist API Evangelist
Discovery
Learnings
Guidance
Toolbox
Alignment
API Evangelist LLC

Are beans created with @ConditionalOnProperty re-evaluated after Spring Boot startup?

calendar_today May 28, 2026 person J_oslee19 domain spring-boot

I am working on a Spring Boot project where the application can use either MongoDB or PostgreSQL depending on a property value. I have two repository implementations: MongoDB repository: @Repository @ConditionalOnProperty(name = “app.storage”, havingValue = “mongo”) public class MongoTreeRepository implements TreeRepository { } PostgreSQL repository: @Repository @ConditionalOnProperty(name = “app.storage”, havingValue = “postgres”) public class PostgresTreeRepository implements TreeRepository { } In application.properties I use either: app.storage=mongo or: app.storage=postgres My service rece

open_in_new Read original post