I am trying to do conditional auto-wiring in Spring using annotation-based configuration. I have 2 different beans both implementing the same interface. I would like to do something like
if(some condition) choose bean 1 to autowire else choose bean 2 to autowire
Is there a way to do this? I noticed the @Primary and @Qualifier annotations, but they will only choose one bean or the other to autowire and not based on some condition. Thanks.