1
0
mirror of synced 2026-05-22 21:33:16 +00:00

Change @Bean method signature to return RsaKeyConversionServicePostProcessor instead of BeanFactoryPostProcessor

It's friendly for Spring Boot's `@ConditionalOnMissingBean`, and:

>> When defining a Spring `@Bean` method, it is generally recommended to declare the most specific type possible as the method's return type. This means returning the concrete class of the bean, or the most specific interface that the bean implements and through which it will be referenced in the application.

Signed-off-by: Yanming Zhou <zhouyanming@gmail.com>
This commit is contained in:
Yanming Zhou
2025-08-08 12:34:20 +08:00
committed by Josh Cummings
parent 7ce2bdd701
commit d86f2c957d
2 changed files with 4 additions and 4 deletions
@@ -33,7 +33,6 @@ import org.springframework.beans.BeansException;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
@@ -79,6 +78,7 @@ import org.springframework.web.filter.ServletRequestPathFilter;
*
* @author Rob Winch
* @author Keesun Baik
* @author Yanming Zhou
* @since 3.2
* @see EnableWebSecurity
* @see WebSecurity
@@ -190,7 +190,7 @@ public class WebSecurityConfiguration implements ImportAware {
}
@Bean
public static BeanFactoryPostProcessor conversionServicePostProcessor() {
public static RsaKeyConversionServicePostProcessor conversionServicePostProcessor() {
return new RsaKeyConversionServicePostProcessor();
}
@@ -21,7 +21,6 @@ import java.util.List;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -44,6 +43,7 @@ import static org.springframework.security.config.Customizer.withDefaults;
/**
* @author Rob Winch
* @author Yanming Zhou
* @since 5.0
*/
@Configuration(proxyBeanMethods = false)
@@ -100,7 +100,7 @@ class WebFluxSecurityConfiguration {
}
@Bean
static BeanFactoryPostProcessor conversionServicePostProcessor() {
static RsaKeyConversionServicePostProcessor conversionServicePostProcessor() {
return new RsaKeyConversionServicePostProcessor();
}