So I have a Parent class and multiple Child classes, such that the Parent class is not managed by Spring (no @Component annotation), but all Child classes are. The constructor of the parent class has some logic, and I need to add one more piece of logic to it, but it requires me to use a Spring Bean. What is the easiest way to do this?
Currently my child classes all use Constructor Injections, so one thing I can do is I can define the parameter in the constructor of the parent class, and in all child classes I can pass that parameter like so: super(newBean);
But this requires me to do a lot of copy pasting in each of the child class, is there a way I can avoid that?
PS: does this design raise any red flags for you guys?