let me demonstrate with code :
public interface A {
....
}
@Profile({"V1"})
@Component
public class B implements A {
....
}
@Profile({"V2"})
@Component
public class C implements A {
....
}
How can i dynamically (on every request that arrives) make spring to autowire one of above classes according to their profile? is it even possible to do such a thing at wiring time?
background : i am seeking a good practice to implement server side version control mechanism. if a request belongs to version 'V1' i want to autowire a class with 'V1' profile and vice versa. (currently i am autowiring a list and iterating them to find the suitable version).