title: @Value on a field in a @Service injected with @MockBean results in null value
body: <p>I have this service:</p>
  
  <pre class="lang-java prettyprint-override"><code>@Service
  public class MyService {
  
      @Value("${my.value}")
      private String myValue;
  
      public String someMethodWhichUsesMyValueField() {
          return myValue;
      }
  
      // Also contains other methods that use some external services accessed with a `RestTemplate`
  }
  </code></pre>
  
  <p>And this integration test:</p>
  
  <pre class="lang-java prettyprint-override"><code>@RunWith(SpringRunner.class)
  @SpringBootTest(classes = MyApplication.class)
  public class MyControllerTest {
  
      private MockMvc myControllerMockMvc;
  
      @Autowired
      private MyController myController; // This controller injects an instance of MyService
  
      @MockBean
      private MyService myServiceMock;
  
      @Before
      public void setup() {
          this.myControllerMockMvc = MockMvcBuilders.standaloneSetup(myController).build();
  
          when(myServiceMock.someMethodWhichUsesMyValueField()).thenCallRealMethod();
          // Also mock the other methods in myServiceMock that call the external webservices
      }
  
  
      @Test
      public void someTest() throws Exception {
          // use the myControllerMockMvc to call a POST method that calls myService.someMethodWhichUsesMyValueField()
      }
  }
  </code></pre>
  
  <p>The problem is that when <code>myService.someMethodWhichUsesMyValueField()</code> is called from the <code>MyController</code> method called from the <code>someTest()</code> method, the field <code>myValue</code> (and all the field annotated with <code>@Autowired</code>) is <code>null</code> even if my <code>application.properties</code> correctly defines <code>my.value=some value</code>.</p>
  
  <p>Is there a way to correctly make <code>myValue</code> inject the value described in the <code>application.properties</code> like any normal <code>@Autowired</code> component?</p>