I have a class B that implements a W-interface. It has a standard implementation of the W method. Class C and D override the default implementation for which they need a service whose spring bean is being created. Line a and b come from the user and therefore I cannot create a bean from B / C / D in advance. Therefore, I have a factory that creates a new object based on user parameters (it will create B / C / D based on parameters). Is there a clean way to use the beans service (aa / bb / cc / dd, etc.) from inside C and D (spring autowires during server startup, at the time needed for the B / C / D instance parameter are unavailable) or is there a better way to solve the problem?
Class B implements W{
String a;
String b;
B (String a, String b);
w_method(){
}
}
Class C extends B {
@Autowired
Service aa;
@Autowired
Service bb;
@Autowired
Service cc;
@override
w_method(){
}
}
Class D extends B {
@Autowired
Service dd;
@override
w_method(){
}
}