title: @Bean not applicable to field
body: <p>I'm learning Spring, doing MKYong's tutorial, and I'm stuck in Spring DI - <a href="http://www.mkyong.com/spring/spring-di-via-setter-method/" rel="nofollow noreferrer">http://www.mkyong.com/spring/spring-di-via-setter-method/</a>.</p>
  
  <p>Tried to change it to Java configuration, but @Bean annotation gives me error as in the top of topic.</p>
  
  <p>IOutputGenerator.java:</p>
  
  <pre><code>public Interface IOutputGenerator{
      public void generateOutput();
  }
  </code></pre>
  
  <p>CsvOutputGenerator.java:</p>
  
  <pre><code>public class CsvOutputGenerator.java implements IOutputGenerator{
      public void generateOutput(){
          System.out.println("CSV Output gen");
      }
  }
  </code></pre>
  
  <p>AppConfig.java:</p>
  
  <pre><code>@Configuration
  public class AppConfig{
      @Bean
      public CsvOutputGenerator csvOutputGenerator;
  }
  </code></pre>
  
  <p>And IntelliJ highlight me this "@Bean" annotation as wrong with message: @Bean not applicable to field.</p>
  
  <p>Anyone?</p>