I think the sorting is unnecessary, because internalPostProcessors
has been sorted in every previous stage of traversing ppNames
.
Secondly, this sorting will break some rules, For example, it will cause nonOrderedPostProcessors to sort by @Order
. But in JavaDoc of BeanPostProcessor ,this is not allowed.
The Ordering section of the class-level Javadoc for BeanPostProcessor states the following.
BeanPostProcessor
beans that are autodetected in anApplicationContext
will be ordered according toPriorityOrdered
andOrdered
semantics. In contrast,BeanPostProcessor
beans that are registered programmatically with aBeanFactory
will be applied in the order of registration; any ordering semantics expressed through implementing thePriorityOrdered
orOrdered
interface will be ignored for programmatically registered post-processors. Furthermore, the@Order
annotation is not taken into account forBeanPostProcessor
beans.
Comment From: snicoll
@chenqimiao thanks for the PR but we'd like to keep this as is. Please also review this note on the class you've modified.