title: Spring Security oAuth complains about missing JWT verifier key even though it's defined
body: <p>I am migrating an application from Spring Boot 1.5 to Spring Boot 2. This entails updating the oAuth2 library that the project uses, since as of Spring Boot 2, the <code>spring-security-oauth2</code> library has been replaced with <code>spring-security-oauth2-autoconfigure</code> (as per my understanding).</p>
  
  <p>Either ways, during startup my project complains about the JWT verifier key (required by oAuth2) as missing, even though I clearly have the URI to the key defined in my <code>application.yml</code> file, along with other oAuth2 config, as follows:</p>
  
  <pre><code>security:
    oauth2:
      client:
        userAuthorizationUri: ${uaa.url}/oauth/authorize
        accessTokenUri: ${uaa.url}/oauth/token
        clientId: ${security.oauth2.client.client-id}
        clientSecret: ${security.oauth2.client.client-secret}
      resource:
        jwt:
          keyUri: ${uaa.url}/oauth/token_key
  </code></pre>
  
  <p>The error that I get during startup is:</p>
  
  <pre><code>***************************
  APPLICATION FAILED TO START
  ***************************
  
  Description:
  
  Binding to target org.springframework.boot.autoconfigure.security.oauth2.resource.ResourceServerProperties@468bb799 failed:
  
      Property: resourceServerProperties.tokenInfoUri
      Value: null
      Reason: Missing tokenInfoUri and userInfoUri and there is no JWT verifier key
  </code></pre>
  
  <p>This configuration worked perfectly until I was using Spring Boot 1.5.x, but after upgrading to Spring Boot 2 (and moving to the <code>spring-security-oauth2-autoconfigure</code> library), I have started getting this problem.</p>
  
  <p>I can access the key in my browser by visiting the URL defined as <code>keyUri: ${uaa.url}/oauth/token_key</code> in the config above, so it's clearly a valid URL. What could be the problem here?</p>
  
  <p>Edit: One of the solutions I found online at several places was adding a dummy userInfoUri value, like this:</p>
  
  <pre><code>security:
    oauth2:
      resource:
        userInfoUri: BUGFIX
  </code></pre>
  
  <p>I tried this, still getting the same error.</p>