I need to refactor a factory method with @ConditionalOnProperty
. Say I have following:
public interface Base {
public String getName();
}
public class Inst1 implements Base {
public String getName() {
return "Inst1";
}
}
public class Inst2 implements Base {
public String getName() {
return "Inst1";
}
}
public class Client {
void Main() {
Base inst = ...
String name = inst.GetName();
}
}
properties file:
service.InstType=Inst2
I did read The Spring @ConditionalOnProperty Annotation but still couldn’t figure it out.
I need the most simple implementation of the annotation for case above.