I have a spring boot application in which I want to Autowire a bean for which implementation is specified in application.yaml. What is the best way to achieve it?
@Component
public class FooFormatter implements Formatter {}
@Component
public class BarFormatter implements Formatter {}
public class MyService {
@Autowired
@Qualifier("value_from_config")// The implementation is specified in application.yaml file
private Formatter formatter;
}