I have a @Service
annotated class which provides core functionality which I can use in all my projects:
@Service
public class MyService {}
If you want to use the placeholder, another workaround is to use @Bean in a @Configuration class using @Value and the Spring applicationContext.
@Configuration
public class AppConfig {
@Autowired
private ApplicationContext context;
@Bean
public MyService myService(@Value("${myService.qualifier}") String qualifier) {
return (MyService) context.getBean(qualifier);
}
}
NB : special consideration must be taken for the placeholder bean which must be loaded at the beginning (cf javadoc)