title: I have set up oauth2 properties in application.properties, How to use them in the code?
body: <p>In my Spring boot application I am using google oauth2 to get users signed in from their gmail account. I have obtained and set the client id, secret and scope using my account details and tested the program. <br> But now I need to run this in a separate environment so all the hard coded configurations must be gone. <br> I added the client id , seceret and scope in my <strong>application.properties</strong> file as follows, <br></p>
  
  <pre><code>security.oauth2.client.id= 5******-5**bd***a6.apps.googleusercontent.com
  security.oauth2.client.client-secret=m******qb***H
  security.oauth2.client.scope[0]=https://www.googleapis.com/auth/admin.directory.user.readonly 
  </code></pre>
  
  <p>Now how to use this properties in my java class. for <strong>example</strong></p>
  
  <pre><code> public static String getToken() throws Exception {
  
      String clientId =  "5******-5**bd***a6.apps.googleusercontent.com";
      String clientSecret = "m******qb***H";
      String scope = "https://www.googleapis.com/auth/admin.directory.user.readonly ";
  
      AuthorizationCodeFlow flow=
              new AuthorizationCodeFlow.Builder(BearerToken.authorizationHeaderAccessMethod(),
                      new NetHttpTransport(),
                      new JacksonFactory(),
                      new GenericUrl(GoogleOAuthConstants.TOKEN_SERVER_URL),
                      new BasicAuthentication(clientId, clientSecret),
                      clientId,
                      GoogleOAuthConstants.AUTHORIZATION_SERVER_URL)
                      .setScopes(Collections.singleton(scope)).build();
  </code></pre>
  
  <p>I want to create a config class and get the id,secret,scope values from the .properties file and then use those here. <strong>All this should be done using Spring</strong> not by file reading please.</p>