title: Could not autowire. No beans of type 'int' found
body: <p>I'm working with Spring Boot and I'm having a little trouble understanding Beans. I'm led to believe Beans replace the <code>new</code> keyword.</p>
  
  <p>I identified when using just Autowire my Beans wouldn't create a new instance on an Object and my REST application would return the same response the User first asked for no matter what (i.e. If I visited url/id/1 initially, then visited url/id/2 the REST response would be the same as url/id/1). </p>
  
  <p>I tried to solve this by creating an @Configuration file to define a bean.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>@Configuration
  public class UserConfig {
  
      @Autowired
      UserDAO DAO;
  
      @Bean
      public User getUser(int uid) {
          try {
              return DAO.getUser(uid);
          } catch (SIDException e) {
              return null;
          }
      }
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>But I keep getting this error on runtime: <code>Parameter 0 of method getUser in com.application.Config.UserConfig required a bean of type 'int' that could not be found.</code></p>
  
  <p>I don't understand this, as I'm trying to define the Bean in the Configuration file. </p>
  
  <p>In my main file I have these annotations:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>@SpringBootApplication(scanBasePackages = {"com.application.Config","com.application"})
  @ComponentScan({"com.application.Config","com.application"})</code></pre>
  </div>
  </div>
  </p>
  
  <p>And I'm using my bean in this context, if it helps:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>@Service
  public class UserService {
  
      @Autowired
      private UserDAO DAO;
  
      public User getUser(int uid) {
          try {
              return DAO.getUser(uid);
          } catch (SIDException e) {
              return null;
          }
      }
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Thank you :)</p>