title: Spring Oauth2 client credentials flow example
body: <p>I am trying to implement service to service security into spring boot services using spring oauth2. I want a service to access a secured resource of another service without any user action involved.</p>
  
  <p>There are a lot of examples for authorization code grant type, but not very much about the client credentials grant type, which seems to be the right one for this use case.</p>
  
  <p>I can set up the auth server and use a curl request to get a token.
  The tests I found used Http Objects to check status codes.</p>
  
  <p>How can I use the client credentials grant type in a java client with RestTemplate and spring oauth2?</p>
  
  <p>I would think it must be as simple as adding a dependency, an annotation and a config file, yet I can't make it run.</p>