Ich versuche, die Frühlingssicherheitsversion von 6.1.9 auf 6.2.8 zu verbessern.
Ich habe die Änderungen vorgenommen und erstellt ist erfolgreich. Aber wenn ich die Bereitstellung mache, erhalte ich unter dem Fehler. < /p>
SEVERE [main] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class [org.springframework.web.context.ContextLoaderListener]
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.security.config.annotation.web.configuration.OAuth2ClientConfiguration$OAuth2ClientWebMvcSecurityConfiguration': Unsatisfied dependency expressed through method 'setAuthorizedClientManagerRegistrar' parameter 0: No qualifying bean of type 'org.springframework.security.config.annotation.web.configuration.OAuth2ClientConfiguration$OAuth2AuthorizedClientManagerRegistrar' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: { } < b r / > a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . a n n o t a t i o n . A u t o w i r e d A n n o t a t i o n B e a n P o s t P r o c e s s o r $ A u t o w i r e d M e t h o d E l e m e n t . r e s o l v e M e t h o d A r g u m e n t s ( A u t o w i r e d A n n o t a t i o n B e a n P o s t P r o c e s s o r . j a v a : 8 9 6 ) < b r / > a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . a n n o t a t i o n . A u t o w i r e d A n n o t a t i o n B e a n P o s t P r o c e s s o r $ A u t o w i r e d M e t h o d E l e m e n t . i n j e c t ( A u t o w i r e d A n n o t a t i o n B e a n P o s t P r o c e s s o r . j a v a : 8 4 9 ) < b r / > a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . a n n o t a t i o n . I n j e c t i o n M e t a d a t a . i n j e c t ( I n j e c t i o n M e t a d a t a . j a v a : 1 4 5 ) < b r / > a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . a n n o t a t i o n . A u t o w i r e d A n n o t a t i o n B e a n P o s t P r o c e s s o r . p o s t P r o c e s s P r o p e r t i e s ( A u t o w i r e d A n n o t a t i o n B e a n P o s t P r o c e s s o r . j a v a : 5 0 9 ) < b r / > a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . p o p u l a t e B e a n ( A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . j a v a : 1 4 3 9 ) < b r / > a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . d o C r e a t e B e a n ( A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . j a v a : 5 9 9 ) < b r / > a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . c r e a t e B e a n ( A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . j a v a : 5 2 2 ) < b r / > a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t B e a n F a c t o r y . l a m b d a $ d o G e t B e a n $ 0 ( A b s t r a c t B e a n F a c t o r y . j a v a : 3 3 7 ) < b r / > a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . D e f a u l t S i n g l e t o n B e a n R e g i s t r y . g e t S i n g leton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:335)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:975)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:971)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:625)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:394)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:274)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:102)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4019)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4444)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:566)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:653)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1094)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1897)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:123)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1005)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:389)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1593)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:267)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:109)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:389)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:336)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:743)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:771)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1170)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1160)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:716)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:203)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:415)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:866)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164)
at org.apache.catalina.startup.Catalina.start(Catalina.java:759)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:569)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:342)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:470)
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.security.config.annotation.web.configuration.OAuth2ClientConfiguration$OAuth2AuthorizedClientManagerRegistrar' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1889)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1406)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1353)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.resolveMethodArguments(AutowiredAnnotationBeanPostProcessor.java:888)
... 56 more
< /code>
Dies ist meine Konfigurationsklasse. < /p>
@Configuration
@EnableWebSecurity
public class OAuth2ClientSecurityConfig {
// Code ...
@Bean
public ClientRegistrationRepository clientRegistrationRepository() {
return new InMemoryClientRegistrationRepository(List.of(getClientRegistration()));
}
private ClientRegistration getClientRegistration() {
// Code ...
}
@Bean
public OAuth2ProtectedResourceDetailsCustom buildOAuth2ProtectedResourceDetailsCustom(){
// Code ...
}
@Bean
public OAuth2AuthorizedClientService authorizedClientService(ClientRegistrationRepository clientRegistrationRepository) {
return new InMemoryOAuth2AuthorizedClientService(clientRegistrationRepository);
}
@Bean
public OAuth2AuthorizedClientRepository authorizedClientRepository(OAuth2AuthorizedClientService authorizedClientService) {
return new AuthenticatedPrincipalOAuth2AuthorizedClientRepository(authorizedClientService);
}
@Bean
public OAuth2AuthorizedClientManager authorizedClientManager(
ClientRegistrationRepository clientRegistrationRepository,
OAuth2AuthorizedClientRepository authorizedClientRepository) {
OAuth2AuthorizedClientProvider authorizedClientProvider =
OAuth2AuthorizedClientProviderBuilder.builder()
.authorizationCode()
.refreshToken()
.clientCredentials()
.password()
.build();
DefaultOAuth2AuthorizedClientManager authorizedClientManager =
new DefaultOAuth2AuthorizedClientManager(
clientRegistrationRepository, authorizedClientRepository);
authorizedClientManager.setAuthorizedClientProvider(authorizedClientProvider);
return authorizedClientManager;
}
@Bean
public AuthorizationRequestRepository authorizationRequestRepository() {
// Code ...
}
@Bean
public OAuth2AuthorizationRequestRedirectFilter oAuth2AuthorizationRequestRedirectFilter(CustomOAuth2AuthorizationRequestResolver customOAuth2AuthorizationRequestResolver){
// Code ...
}
@Bean("customOAuth2AuthorizationRequestResolver")
public CustomOAuth2AuthorizationRequestResolver authorizationRequestResolver(
ClientRegistrationRepository clientRegistrationRepository) {
// Code ...
}
@Bean("customOAuth2LoginAuthenticationFilter")
@Order(PriorityOrdered.HIGHEST_PRECEDENCE)
public CustomOAuth2LoginAuthenticationFilter customOAuth2LoginAuthenticationFilter(ClientRegistrationRepository clientRegistrationRepository,OAuth2AuthorizedClientRepository authorizedClientRepository,
CustomOAuth2LoginAuthenticationProvider customOAuth2LoginAuthenticationProvider,
RoleBasedAuthenticationSuccessHandler redirectRoleStrategy,OAuthAuthenticationFailureHandler oAuthAuthenticationFailureHandler){
// Code ...
}
@Bean("customOAuth2LoginAuthenticationProvider")
public CustomOAuth2LoginAuthenticationProvider customOAuth2LoginAuthenticationProvider(
OAuth2AccessTokenResponseClient accessTokenResponseClient,CustomOAuth2UserService customOAuth2UserService){
return new CustomOAuth2LoginAuthenticationProvider(accessTokenResponseClient,customOAuth2UserService);
}
@Bean
public DefaultAuthorizationCodeTokenResponseClient accessTokenResponseClient(){
return new DefaultAuthorizationCodeTokenResponseClient();
}
@Bean
public CustomOAuth2UserService customOAuth2UserService(){
return new CustomOAuth2UserService();
}
@Bean("oAuthAuthenticationFailureHandler")
public OAuthAuthenticationFailureHandler oAuthAuthenticationFailureHandler(){
return new OAuthAuthenticationFailureHandler();
}
}
< /code>
Dies ist mein pom.xml, es enthält auch andere Zeilen. < /p>
org.springframework.security
spring-security-config
6.2.8
org.springframework.security
spring-security-core
6.2.8
org.springframework.security
spring-security-oauth2-client
6.2.8
org.springframework
spring-core
6.1.15
< /code>
Ich habe versucht, Spring Security Starter im POM hinzuzufügen, aber es funktioniert nicht.
für 6.1.9 und SpringFramework 6.1.14. Das System funktioniert gut.
Fehler beim Erstellen von Bean mit dem Namen 'org.springframework.security.config.annotation.web.configuration.oAUTH2Cli ⇐ Java
-
- Similar Topics
- Replies
- Views
- Last post