I searched for this in a lot of ways already but couldn't find anything related to it. I'm having an issue where no spring bean inside another bean (that is extended) is being autowired.
What I have is this:
interface A {
}
@Service
class B implements A {
@Autowired
private RandomSpringBean randomSpringBean;
}
@Primary
@Service
class C extends B {
}
And what is happening is that RandomSpringBean inside B isn't being autowired when it's being called by another class that autowires B, but only by classes that autowire C, like this:
class D {
@Autowired
private B b;//beans inside B are null
}
class E {
@Autowired
private C c;//beans inside B (C subclass) are not null
}
Both D and E are being autowired inside other classes. If I comment out/remove C, B goes back to working properly.
I hope that wasn't too confusing.
Ps: I didn't do it like this, it was someone else. I'm just having this issue and want to know a way to fix it, maybe without making C stop extending B.