Apply same order than original BPP
This commit updates ImportAwareAotBeanPostProcessor to be priority ordered, with the same order as its original BeanPostProcessor. This makes sure that infrastructure beans can be post-processed if necessary See gh-28915
This commit is contained in:
@@ -20,6 +20,8 @@ import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.PriorityOrdered;
|
||||
import org.springframework.core.type.classreading.CachingMetadataReaderFactory;
|
||||
import org.springframework.core.type.classreading.MetadataReader;
|
||||
import org.springframework.core.type.classreading.MetadataReaderFactory;
|
||||
@@ -33,7 +35,7 @@ import org.springframework.util.ClassUtils;
|
||||
* @author Stephane Nicoll
|
||||
* @since 6.0
|
||||
*/
|
||||
public final class ImportAwareAotBeanPostProcessor implements BeanPostProcessor {
|
||||
public final class ImportAwareAotBeanPostProcessor implements BeanPostProcessor, PriorityOrdered {
|
||||
|
||||
private final MetadataReaderFactory metadataReaderFactory;
|
||||
|
||||
@@ -54,6 +56,11 @@ public final class ImportAwareAotBeanPostProcessor implements BeanPostProcessor
|
||||
return bean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return Ordered.LOWEST_PRECEDENCE; // match priority of original post processor
|
||||
}
|
||||
|
||||
private void setAnnotationMetadata(ImportAware instance) {
|
||||
String importingClass = getImportingClassFor(instance);
|
||||
if (importingClass == null) {
|
||||
|
||||
Reference in New Issue
Block a user