Answer the question
In order to leave comments, you need to log in
How to parametrize springBoot bean on the fly?
There is a component:
@Component
public class Provider<EntityType> extends AbstractProvider<EntityType> {
@Autowired
private ApplicationContext appCxt;
MyService<EntityType> myService;
}
public void initService(Class clazz) {
final String entityClassName = clazz.getName();
if (MyObjectService.class.getName.equals(entityClassName)){
this.myService= appCxt.getBean(MyObjectService.class);
}
Answer the question
In order to leave comments, you need to log in
1. Make all possible beans for MyService. Those. create implementations of all services. It is possible through xml or config class
2. Inject as List myServices
3. Search in myServices for the implementation you need
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question