Private @Scheduled methods end up on 'empty' proxy instance in case of CGLIB auto-proxying [SPR-12308] #16913
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
status: backported
An issue that has been backported to maintenance branches
type: bug
A general bug
Milestone
Yonatan Graber opened SPR-12308 and commented
When having a bean with a
@Scheduled
private method, the scheduled invocation when a pointcut exists for that method will succeed, but nothing will get injected into@Autowired
fields. Setting other visibility for the method would solve it.For example:
The above code will work if no AOP is defined. If an
@Around
aspect is defined, ping will throw aNullPointException
. Changing ping to be package protected will cause it to work again.If there's a technical implementation problem with scheduling a private method under those conditions, I expect it to fail the deployment, rather than providing a sterile, non-injected bean.
Affects: 3.2.11, 4.0.7
Referenced from: commits 473d973, 01724d3, 47ed4d6
Backported to: 4.0.8, 3.2.12
The text was updated successfully, but these errors were encountered: