title: Oauth2 Client in Spring security
body: <p>I have troube finding example for OAuth2 client implemented using Spring.</p>
  
  <p>I have OAuth2 authorization and resource server implemented using Spring. I want to get access token from that authorization server. I need an example how to get access token from my OAuth2 server using only client credentials. There is no user involved, just my client app getting access token using client credentials and then using it to access <strong>client</strong> resources.</p>
  
  <p>I found only example using Java libraries, but I assume there is support for that in Spring's OAuth2 framework.</p>
  
  <p>If possible, example should contain OAuth2 client, OAuth2 Authorization server  and OAuth2 resource server, all communicating over TLS using self signed certificate, implemented using Spring, using no xml configuration.</p>
  
  <p>Here is the sequence diagram:</p>
  
  <p><a href="https://i.stack.imgur.com/D1Tn4.png" rel="noreferrer"><img src="https://i.stack.imgur.com/D1Tn4.png" alt="enter image description here"></a></p>