I have a Spring 2.5/Java/Tomcat application. There is the following bean, which is used throughout the application in many places
publi
The reason why @Resource(name = "{your child class name}") works but @Autowired sometimes don't work is because of the difference of their Matching sequence
Matching sequence of @Autowire
Type, Qualifier, Name
Matching sequence of @Resource
Name, Type, Qualifier
The more detail explanation can be found here:
Inject and Resource and Autowired annotations
In this case, different child class inherited from the parent class or interface confuses @Autowire, because they are from same type; As @Resource use Name as first matching priority , it works.