title: My class fileds are getting initialized may be because I have a @bean for the same class but in a different .java file
body: <p>I am new to spring and annotations.
  I started the application in debug mode and I found that by the time my code reaches init() method of Actuator below values got assigned to actVar1 and actVar2.</p>
  
  <p>actVar1 has "abc" value</p>
  
  <p>actVar2 has  "xyz" value</p>
  
  <p>Note: My application is not yet started completely . I am just trying with debug point in init() method for a different purpose and I observed above thing.</p>
  
  <p>My question is why those variables have assigned those values.</p>
  
  <pre><code>//Actuator.java 
  @Component
  public class Actuator {
  private String actVar1;
  private String actVar2;
  //.. some code here
  @PostConstruct
  public void init(){
  //my debug point is here 
  //some code .....
  }
  //.. some code here
  
  }
  //Beancreator.java
  @Component
  public class BeanCreator {
  //.. some code here
  private String first="abc";
  private field2 second ="xyz";
  //.. some code here
  
  @Bean 
  public Actuator actuator() { 
  Actuator actuator = new Actuator(); 
  actuator.setActVar1(first); 
  actuator.setActVar2(second); 
  return actuatorPoller; 
  } 
  //.. some code here
  }
  </code></pre>
  
  <p>When I change the method name under @Bean to different one ,those values are not getting assigned .</p>