Browse Source

Declare empty default postProcessBeanFactory method

Closes gh-31476
pull/31483/head
Juergen Hoeller 11 months ago
parent
commit
6dc79b5105
  1. 13
      spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionRegistryPostProcessor.java
  2. 10
      spring-context/src/test/java/org/springframework/context/support/BeanFactoryPostProcessorTests.java

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

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -18,6 +18,7 @@ package org.springframework.beans.factory.support; @@ -18,6 +18,7 @@ package org.springframework.beans.factory.support;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
/**
* Extension to the standard {@link BeanFactoryPostProcessor} SPI, allowing for
@ -42,4 +43,14 @@ public interface BeanDefinitionRegistryPostProcessor extends BeanFactoryPostProc @@ -42,4 +43,14 @@ public interface BeanDefinitionRegistryPostProcessor extends BeanFactoryPostProc
*/
void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException;
/**
* Empty implementation of {@link BeanFactoryPostProcessor#postProcessBeanFactory}
* since custom {@code BeanDefinitionRegistryPostProcessor} implementations will
* typically only provide a {@link #postProcessBeanDefinitionRegistry} method.
* @since 6.1
*/
@Override
default void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
}
}

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

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -193,10 +193,6 @@ class BeanFactoryPostProcessorTests { @@ -193,10 +193,6 @@ class BeanFactoryPostProcessorTests {
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
registry.registerBeanDefinition("bfpp1", new RootBeanDefinition(TestBeanFactoryPostProcessor.class));
}
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
}
}
@ -224,10 +220,6 @@ class BeanFactoryPostProcessorTests { @@ -224,10 +220,6 @@ class BeanFactoryPostProcessorTests {
registry.registerBeanDefinition("anotherpp", new RootBeanDefinition(TestBeanDefinitionRegistryPostProcessor.class));
registry.registerBeanDefinition("ppp", new RootBeanDefinition(PrioritizedBeanDefinitionRegistryPostProcessor.class));
}
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
}
}

Loading…
Cancel
Save