Skip to content

Commit 6dc79b5

Browse files
committed
Declare empty default postProcessBeanFactory method
Closes gh-31476
1 parent cb4d44b commit 6dc79b5

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionRegistryPostProcessor.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2010 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@
1818

1919
import org.springframework.beans.BeansException;
2020
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
21+
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
2122

2223
/**
2324
* Extension to the standard {@link BeanFactoryPostProcessor} SPI, allowing for
@@ -42,4 +43,14 @@ public interface BeanDefinitionRegistryPostProcessor extends BeanFactoryPostProc
4243
*/
4344
void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException;
4445

46+
/**
47+
* Empty implementation of {@link BeanFactoryPostProcessor#postProcessBeanFactory}
48+
* since custom {@code BeanDefinitionRegistryPostProcessor} implementations will
49+
* typically only provide a {@link #postProcessBeanDefinitionRegistry} method.
50+
* @since 6.1
51+
*/
52+
@Override
53+
default void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
54+
}
55+
4556
}

spring-context/src/test/java/org/springframework/context/support/BeanFactoryPostProcessorTests.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -193,10 +193,6 @@ public int getOrder() {
193193
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
194194
registry.registerBeanDefinition("bfpp1", new RootBeanDefinition(TestBeanFactoryPostProcessor.class));
195195
}
196-
197-
@Override
198-
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
199-
}
200196
}
201197

202198

@@ -224,10 +220,6 @@ public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) t
224220
registry.registerBeanDefinition("anotherpp", new RootBeanDefinition(TestBeanDefinitionRegistryPostProcessor.class));
225221
registry.registerBeanDefinition("ppp", new RootBeanDefinition(PrioritizedBeanDefinitionRegistryPostProcessor.class));
226222
}
227-
228-
@Override
229-
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
230-
}
231223
}
232224

233225

0 commit comments

Comments
 (0)