In your implementations, add the bean name.
public class OldFeatureService implements FeatureService{
@Service("oldFeatureService")
public String testMe() {
return "Hello from OldFeatureService";
}
}
public class NewFeatureService implements FeatureService{
@Service("newFeatureService")
public String testMe() {
return "Hello from NewFeatureService";
}
}
By default, springboot uses the bean with @Qualifier("OldFeatureService"). When the flag is enabled, it looks for the alterbean=newFeatureService