title: Replacing Spring bean injection via XML with annotation injection
body: <p>I want to declare and inject a bean through annotations. It was previously done through XML, but I need to apply on a Spring Boot project.</p>
  
  <p>Here is the source xml</p>
  
  <pre><code>&lt;oauth:resource-details-service id="rds"&gt;
      &lt;oauth:resource
              id="oauth1"
              key="${key}"
              secret="${secret}"
              request-token-url="${token}"
              user-authorization-url="${user-auth}"
              access-token-url="${accesstokenurl}"&gt;
      &lt;/oauth:resource&gt;
  &lt;/oauth:resource-details-service&gt;
  </code></pre>
  
  <p>The bean was later used like this </p>
  
  <pre><code>&lt;bean class="org.springframework.security.oauth.consumer.client.OAuthRestTemplate"&gt;
      &lt;constructor-arg ref="oauth1"/&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>The only way I found is through direct instantiation</p>
  
  <pre><code>BaseProtectedResourceDetails resourceDetails = new BaseProtectedResourceDetails();
  resourceDetails.set...
  resourceDetails.set...
  OAuthRestTemplate restTemplate = new OAuthRestTemplate(resourceDetails);
  </code></pre>
  
  <p>What would be the proper way to do this?</p>