Beanfactory postprocessors for different levels of execution, first get the name, then instantiate! I don't think it's necessary. It can be solved in one cycle!

Initial code

List<String> orderedPostProcessorNames = new ArrayList<>();
List<String> nonOrderedPostProcessorNames = new ArrayList<>();

else if (beanFactory.isTypeMatch(ppName, Ordered.class)) {
        orderedPostProcessorNames.add(ppName);
}else {
       nonOrderedPostProcessorNames.add(ppName);
}

Modified code

List<BeanFactoryPostProcessor> orderedPostProcessors = new ArrayList<>();
List<BeanFactoryPostProcessor> nonOrderedPostProcessors = new ArrayList<>();
else if (beanFactory.isTypeMatch(ppName, Ordered.class)) {
       orderedPostProcessors.add(beanFactory.getBean(ppName, BeanFactoryPostProcessor.class));
}
else {
       nonOrderedPostProcessors.add(beanFactory.getBean(ppName, BeanFactoryPostProcessor.class));
}

Please check the submission details for the specific code

update method org.springframework.context.support.PostProcessorRegistrationDelegate#invokeBeanFactoryPostProcessors(org.springframework.beans.factory.config.ConfigurableListableBeanFactory, java.util.List<org.springframework.beans.factory.config.BeanFactoryPostProcessor>)

Comment From: pivotal-issuemaster

@huangfusuper Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

Comment From: pivotal-issuemaster

@huangfusuper Thank you for signing the Contributor License Agreement!

Comment From: ttddyy

I believe priority ordered BFPPs need to be applied first, THEN rest of the BFPP can be instantiated.

Comment From: quaff

I'm sure this PR will break existed correct behavior.