Error creating bean with name 'ResourceServerConfiguration' - Spring Boot Security OAuth2




Asked on January 11, 2020
Hi, I am creating Spring Boot Security OAuth2 simple application and getting this error. What am I missing?

2020-01-11 21:16:18.626  WARN 5284 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfiguration': Unsatisfied dependency expressed through field 'tokenServices'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.security.oauth2.resource.ResourceServerTokenServicesConfiguration$RemoteTokenServicesConfiguration$TokenInfoServicesConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'resourceServerProperties' defined in class path resource [org/springframework/boot/autoconfigure/security/oauth2/OAuth2AutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors
Field error in object 'resourceServerProperties' on field 'tokenInfoUri': rejected value [null]; codes [missing.tokenInfoUri.resourceServerProperties.tokenInfoUri,missing.tokenInfoUri.tokenInfoUri,missing.tokenInfoUri.java.lang.String,missing.tokenInfoUri]; arguments []; default message [Missing tokenInfoUri and userInfoUri and there is no JWT verifier key]




Replied on January 11, 2020
Try using @EnableAuthorizationServer with @Configuration in Java Config or use it with @SpringBootApplication as below.

@SpringBootApplication
@EnableAuthorizationServer
public class Main  {
public static void main(String[] args) {
SpringApplication.run(SecurityConfiguration.class, args);
}
}


Write Answer










©2024 concretepage.com | Privacy Policy | Contact Us