-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: bugA general bugA general bug
Milestone
Description
Doug Davies opened SPR-12490 and commented
@Resource injection seems to behave differently between spring-framework 4.1.0 and 4.1.1 because it thinks a method in a class extended from an abstract class is a bridge and it never calls the setter.
For example
abstract class AbstractComponent {
@Resource
public void setHttpServletRequest(final HttpServletRequest request) {
System.out.println("Setting HttpServletRequest");
}
}
@Component
public final class RealComponent extends AbstractComponent {
}
If I change the @Resource to @Autowired then it works as expected.
I think the change that broke this is
It was to resolve #16801
I have provided a complete spring-boot project that demonstrates the issue at
https://github.com/funkyvisions/spring-boot-hello-world
Affects: 4.1.1, 4.1.2
Reference URL: http://stackoverflow.com/questions/27234508/resource-injection-broken-under-spring-framework-4-1-0
Issue Links:
- Annotation based injection into non public base classes does not work [SPR-7900] #12555 Annotation based injection into non public base classes does not work
- Java 8 bridge method handling can lead to false positive detection of autowired annotations [SPR-12187] #16801 Java 8 bridge method handling can lead to false positive detection of autowired annotations
- Consistent bridge method handling in annotation post-processors [SPR-12495] #17101 Consistent bridge method handling in annotation post-processors
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: bugA general bugA general bug