title: Why @PostConstruct method is not called when autowiring prototype bean with constructor argument
body: <p>I have a prototype-scope bean, which I want to be injected by @Autowired annotation. In this bean, there is also @PostConstruct method which is not called by Spring and I don't understand why.</p>
  
  <p>My bean definition:</p>
  
  <pre><code>package somepackage;
  
  import org.springframework.context.annotation.Scope;
  import org.springframework.stereotype.Component;
  import javax.annotation.PostConstruct;
  
  @Component
  @Scope("prototype")
  public class SomeBean {
  
      public SomeBean(String arg) {
          System.out.println("Constructor called, arg: " + arg);
      }
  
      @PostConstruct
      private void init() {
          System.out.println("Post construct called");
      }
  
  }
  </code></pre>
  
  <p>JUnit class where I want to inject bean:</p>
  
  <pre><code>package somepackage;
  
  import org.junit.Before;
  import org.junit.Test;
  import org.junit.runner.RunWith;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.beans.factory.annotation.Value;
  import org.springframework.context.ApplicationContext;
  import org.springframework.test.context.ContextConfiguration;
  import org.springframework.test.context.junit4.SpringRunner;
  
  @RunWith(SpringRunner.class)
  @ContextConfiguration("classpath*:applicationContext-test.xml")
  public class SomeBeanTest {
  
      @Autowired
      ApplicationContext ctx;
  
      @Autowired
      @Value("1")
      private SomeBean someBean;
  
      private SomeBean someBean2;
  
      @Before
      public void setUp() throws Exception {
          someBean2 = ctx.getBean(SomeBean.class, "2");
      }
  
      @Test
      public void test() {
          System.out.println("test");
      }
  }
  </code></pre>
  
  <p>Spring configuration:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:context="http://www.springframework.org/schema/context"
         xsi:schemaLocation="http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans.xsd
         http://www.springframework.org/schema/context
         http://www.springframework.org/schema/context/spring-context.xsd"&gt;
  
      &lt;context:component-scan base-package="somepackage"/&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>The output from execution:</p>
  
  <pre><code>Constructor called, arg: 1
  Constructor called, arg: 2
  Post construct called
  test
  </code></pre>
  
  <p>When I initialize bean by calling <code>getBean</code> from <code>ApplicationContext</code> everything works as expected. My question is why injecting bean by <code>@Autowire</code> and <code>@Value</code> combination is not calling <code>@PostConstruct</code> method</p>