title: Mockito @Before method is called after @PostConstruct
body: <p>This is my simplified code: </p>
  
  <pre><code>@RunWith(SpringRunner.class)
  @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
  public class MockitoSpringBootTest {
  
      @MockBean
      private MyBean myBean;
  
  
      @Before
      private void before(){
          Mockito.when(myBean.getSomeString()).thenReturn("TEST"));
      }
  
  }
  
  @Service
  private class TestClass {
  
      @Autowired
      private MyBean myBean;
  
      @PostConstruct
      public void initialize() {
          myBean.getSomeString(); //SmartNull - method is not stubbed yet
      }
  
  }
  </code></pre>
  
  <p>My problem is that I need to stub <code>MyBean</code> methods, before any other class which has this object autowired will run <code>@BeforeClass</code> method. Right now <code>@Before</code> method is executed after <code>@PostConstruct</code> of any class which is autowiring this bean (there's more than one). </p>
  
  <p>MyBean is autowired as a mock, but method is not stubbed, so I get: "SmartNull returned by this unstubbed method call on a mock:"</p>
  
  <p>Is there any way to set priority of mocked bean in Spring container initialization ? </p>