diff --git a/config/src/main/java/org/springframework/security/config/http/AuthenticationConfigBuilder.java b/config/src/main/java/org/springframework/security/config/http/AuthenticationConfigBuilder.java index d71fff6587..632a55e223 100644 --- a/config/src/main/java/org/springframework/security/config/http/AuthenticationConfigBuilder.java +++ b/config/src/main/java/org/springframework/security/config/http/AuthenticationConfigBuilder.java @@ -636,7 +636,7 @@ final class AuthenticationConfigBuilder { } RootBeanDefinition bean = new RootBeanDefinition(UserDetailsServiceFactoryBean.class); bean.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); - pc.getReaderContext().getRegistry().registerBeanDefinition(BeanIds.USER_DETAILS_SERVICE_FACTORY, bean); + pc.registerBeanComponent(new BeanComponentDefinition(bean, BeanIds.USER_DETAILS_SERVICE_FACTORY)); } List getFilters() {