Abbin Varghese
Abbin Varghese

Reputation: 2774

Difference between OAuth2RestOperations and OAuth2RestTemplate in Spring oAuth2

What exactly is the difference between OAuth2RestOperations and OAuth2RestTemplate. And when should we use OAuth2RestOperations and when should we use OAuth2RestTemplate ?

(Looking for a functional explanation.)

Upvotes: 0

Views: 3040

Answers (1)

Federico Piazza
Federico Piazza

Reputation: 30995

OAuth2RestOperations is an interface that is actually implemented by OAuth2RestTemplate class.

From OAuth2RestTemplate documentation you can read:

Rest template that is able to make OAuth2-authenticated REST requests with the credentials of the provided resource.

Therefore, if you want to use the out of the box class then you can use OAuth2RestTemplate, however you can create your own custom implementation to suit your needs by implementing OAuth2RestOperations in case OAuth2RestTemplate is not for your needs.

Upvotes: 2

Related Questions