title: Not able to read application properties from Spring Boot in JUnit?
body: <p>I have a <code>JUnit</code> test that I would like to run against a <code>REST</code> service which is already running on my machine at the specified port. Already tested the <code>REST</code> service with <code>Postman</code> and it works fine. </p>
  
  <p>The plan here is to make the <code>REST</code> URLs configurable by externalizing them in a properties file. Hence I tried following and the <code>JUnit</code> class is not able to read the properties file value.</p>
  
  <p><strong>StoreClientTest.java</strong></p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @PropertySource("classpath:application.properties")
  public class StoreClientTest {
  
      private static final String STORE_URI = "http://localhost:8084/hpdas/store";
      private RestTemplate restTemplate;
  
      @Value("${name}")
      private String name;
  
  
      @Before
      public void setUp() {
          restTemplate = new RestTemplate();
      }
  
  
      @Test
      public void testStore_NotNull() {
          //PRINTS ${name} instead of abc ?????
          System.out.println("name = " + name);
          assertNotNull(restTemplate.getForObject(STORE_URI, Map.class));
      }
  
  
      @After
      public void tearDown() {
          restTemplate = null;
      }
  
  }
  </code></pre>
  
  <p><strong>src\test\main\resources\application.properties</strong></p>
  
  <pre><code>name=abc
  </code></pre>