Closed
Description
Mischa Neumann opened SPR-14692 and commented
if you use @EnableAspectJAutoProxy
and e.g. @EnableScheduling
you might accidentally create a ScheduledMethodRunnable
with an unproxied bean.
this is caused by AnnotationAwareAspectJAutoProxyCreator
and ScheduledAnnotationBeanPostProcessor
both having a default order of Ordered.LOWEST_PRECEDENCE.
as the developer usually has no insight in which post processor is applied in which order and the ordering might be critical for the application to function properly, I would suggest:
- log all post processors and their ordering at INFO level on startup
- force all post processors to have a unique order (there is enough space between Ordered.LOWEST_PRECEDENCE and HIGHEST_PRECEDENCE)
- review the existing spring framework post processors for having a reasonable default order
Affects: 4.2.7
Issue Links:
- Ordered interface not respected on non-singleton aspects [SPR-14959] #19526 Ordered interface not respected on non-singleton aspects
- SchedulingConfigurer's ScheduledTaskRegistrar should reliably shut down before TaskScheduler [SPR-15067] #19633 SchedulingConfigurer's ScheduledTaskRegistrar should reliably shut down before TaskScheduler