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

Best way or recommended to switch between repository implementations in Spring Boot without manually editing application.properties?

calendar_today May 27, 2026 person Alejandro Campos domain spring-boot

I am working on a Spring Boot project where I have multiple repository implementations for the same interface. For example: an in-memory implementation a PostgreSQL implementation a MongoDB implementation I also have different tree-processing strategies in the application depending on configuration. Currently I switch implementations manually using a property in application.properties : app.storage=memory and then use @ConditionalOnProperty : @Repository @ConditionalOnProperty( name = “app.storage”, havingValue = “memory” ) public class MemoryTreeRepository implements TreeRepository { } This w

open_in_new Read original post