title: How to disable Spring autowiring for a certain bean?
body: <p>There are some class in jar (external library), that uses Spring internally.
  So library class has structure like a:</p>
  
  <pre class="lang-java prettyprint-override"><code>@Component
  public class TestBean {
  
      @Autowired
      private TestDependency dependency;
  
      ...
  }
  </code></pre>
  
  <p>And library provides API for constructing objects:</p>
  
  <pre class="lang-java prettyprint-override"><code>public class Library {
  
      public static TestBean createBean() {
          ApplicationContext context = new AnnotationConfigApplicationContext(springConfigs);
          return context.getBean(TestBean);
      }
  }
  </code></pre>
  
  <p>In my application, I have config:</p>
  
  <pre class="lang-java prettyprint-override"><code>@Configuration
  public class TestConfig {
  
      @Bean
      public TestBean bean() {
          return Library.createBean();
      }
  }
  </code></pre>
  
  <p>It's throw en exception: <code>Field dependency in TestBean required a bean of type TestDependency that could not be found.</code>.</p>
  
  <p>But Spring should not trying to inject something, because bean is already configured.</p>
  
  <p>Can i disable Spring autowiring for a certain bean?</p>