We are using jwt.key-value property

security:
  oauth2:
    resource:
      jwt:
        key-value: __KEY__

and dependencies

implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
implementation 'org.springframework.security.oauth:spring-security-oauth2:2.5.1.RELEASE'
implementation 'org.springframework.security.oauth.boot:spring-security-oauth2-autoconfigure:2.5.1'

But the application fails to start with the error

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.servlet.Filter]: Factory method 'springSecurityFilterChain' threw exception; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.security.oauth2.jwt.JwtDecoder' available
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
    ... 72 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.security.oauth2.jwt.JwtDecoder' available
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:351)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:342)
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1172)
    at org.springframework.security.config.annotation.web.configurers.oauth2.server.resource.OAuth2ResourceServerConfigurer$JwtConfigurer.getJwtDecoder(OAuth2ResourceServerConfigurer.java:405)
    at org.springframework.security.config.annotation.web.configurers.oauth2.server.resource.OAuth2ResourceServerConfigurer$JwtConfigurer.getAuthenticationProvider(OAuth2ResourceServerConfigurer.java:414)
    at org.springframework.security.config.annotation.web.configurers.oauth2.server.resource.OAuth2ResourceServerConfigurer.getAuthenticationProvider(OAuth2ResourceServerConfigurer.java:321)
    at org.springframework.security.config.annotation.web.configurers.oauth2.server.resource.OAuth2ResourceServerConfigurer.init(OAuth2ResourceServerConfigurer.java:240)
    at org.springframework.security.config.annotation.web.configurers.oauth2.server.resource.OAuth2ResourceServerConfigurer.init(OAuth2ResourceServerConfigurer.java:140)

Comment From: jgrandja

@alxxyz

The following configuration and dependencies are used by the legacy Spring Security OAuth project:

security:
  oauth2:
    resource:
      jwt:
        key-value: __KEY__
implementation 'org.springframework.security.oauth:spring-security-oauth2:2.5.1.RELEASE'
implementation 'org.springframework.security.oauth.boot:spring-security-oauth2-autoconfigure:2.5.1'

And the dependency:

implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'

is used by the OAuth 2.0 Resource Server support in Spring Security 5.x but you have not defined the correct Spring Boot properties, hence the "No qualifying bean of type org.springframework.security.oauth2.jwt.JwtDecoder" error.

Please review the documentation and samples.