title: multiple instance of autowired bean
body: <p>When a bean is autowired, does it create multiple instances of the class?</p>
  
  <p>Here's an example;</p>
  
  <pre><code>public class ClassA {
  
    @Autowired
    private ClassB classB;
  
    public ClassB getClassB() {
      return classB;
    }
  
    public void setClassB(ClassB classB) {
      this.classB = classB;
    }
  
    // using ClassB in method 1
    public void useClassBmethod1() {
      // currently using autowired ClassB instance
      classB.doSomething();
    }
  
    // using ClassB in method 2
    public void useClassBMethod2() {
      // need a new instance of ClassB but through the same autowired bean
      ClassB classb = getClassB();
    }
  }
  
  public class ClassB {
  
  
    public void doSomething() {}
  }
  </code></pre>
  
  <p>So my question is, does autowiring a bean know how to create a new instance of a bean when needed or this is left to the programmer to decipher?</p>
  
  <p>Thanks for helping out.</p>