title: Spring prototype to singleton and get the value in another class
body: <pre><code>@Component
  scope("prototype")
  Class A{
  
  }
  </code></pre>
  
  <p>Class <strong>A</strong> is of bean scope prototype</p>
  
  <pre><code>@Component
  Class B{
  
  @Autowire
  private A a;
  
   public A getA() {
          return a;
      }
  
      public void setA(A a) {
          this.a = a;
      }
  
  }
  </code></pre>
  
  <p>Class <strong>B</strong> is of bean scope Singleton have getters and setters of <strong>A</strong></p>
  
  <pre><code>Class C{
  
  @Autowire
  private B b;
  
  // other code
  
  b.setA(a);
  
  }
  </code></pre>
  
  <p>In class <strong>C</strong> the  <strong>B</strong> is autowired and set the object of <strong>A</strong></p>
  
  <pre><code>Class D{
  
  @Autowire
  private B b;
  
  // How can I get the value of A which is set in C
  //something like
  
  A a= b.getA();
  
  }
  </code></pre>
  
  <p>How can I get the value of A using B in Class D using spring Annotations or using XML</p>