|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2020 the original author or authors. |
| 2 | + * Copyright 2002-2021 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -59,6 +59,19 @@ private PostProcessorRegistrationDelegate() {
|
59 | 59 | public static void invokeBeanFactoryPostProcessors(
|
60 | 60 | ConfigurableListableBeanFactory beanFactory, List<BeanFactoryPostProcessor> beanFactoryPostProcessors) {
|
61 | 61 |
|
| 62 | + // WARNING: Although it may appear that the body of this method can be easily |
| 63 | + // refactored to avoid the use of multiple loops and multiple lists, the use |
| 64 | + // of multiple lists and multiple passes over the names of processors is |
| 65 | + // intentional. We must ensure that we honor the contracts for PriorityOrdered |
| 66 | + // and Ordered processors. Specifically, we must NOT cause processors to be |
| 67 | + // instantiated (via getBean() invocations) or registered in the ApplicationContext |
| 68 | + // in the wrong order. |
| 69 | + // |
| 70 | + // Before submitting a pull request (PR) to change this method, please review the |
| 71 | + // list of all declined PRs involving changes to PostProcessorRegistrationDelegate |
| 72 | + // to ensure that your proposal does not result in a breaking change: |
| 73 | + // https://github.com/spring-projects/spring-framework/issues?q=PostProcessorRegistrationDelegate+is%3Aclosed+label%3A%22status%3A+declined%22 |
| 74 | + |
62 | 75 | // Invoke BeanDefinitionRegistryPostProcessors first, if any.
|
63 | 76 | Set<String> processedBeans = new HashSet<>();
|
64 | 77 |
|
@@ -192,6 +205,19 @@ else if (beanFactory.isTypeMatch(ppName, Ordered.class)) {
|
192 | 205 | public static void registerBeanPostProcessors(
|
193 | 206 | ConfigurableListableBeanFactory beanFactory, AbstractApplicationContext applicationContext) {
|
194 | 207 |
|
| 208 | + // WARNING: Although it may appear that the body of this method can be easily |
| 209 | + // refactored to avoid the use of multiple loops and multiple lists, the use |
| 210 | + // of multiple lists and multiple passes over the names of processors is |
| 211 | + // intentional. We must ensure that we honor the contracts for PriorityOrdered |
| 212 | + // and Ordered processors. Specifically, we must NOT cause processors to be |
| 213 | + // instantiated (via getBean() invocations) or registered in the ApplicationContext |
| 214 | + // in the wrong order. |
| 215 | + // |
| 216 | + // Before submitting a pull request (PR) to change this method, please review the |
| 217 | + // list of all declined PRs involving changes to PostProcessorRegistrationDelegate |
| 218 | + // to ensure that your proposal does not result in a breaking change: |
| 219 | + // https://github.com/spring-projects/spring-framework/issues?q=PostProcessorRegistrationDelegate+is%3Aclosed+label%3A%22status%3A+declined%22 |
| 220 | + |
195 | 221 | String[] postProcessorNames = beanFactory.getBeanNamesForType(BeanPostProcessor.class, true, false);
|
196 | 222 |
|
197 | 223 | // Register BeanPostProcessorChecker that logs an info message when
|
|
0 commit comments