title: Value annotation not working in Junit test
body: <pre><code>@SpringBootTest
  public class RuleControllerTest {
  
  @Value("${myUrl}")
  private String myUrl;
  private HttpClient httpClient = HttpClients.createDefault();
  
  @Test
  public void loadAllRules() throws IOException, URISyntaxException {
      String target = myUrl + "/v2/rules";
      String json = generateHTTPget(target);
  
      ObjectMapper objectMapper = new ObjectMapper();
      objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
      Rule[] rules = objectMapper.readValue(json, Rule[].class);
  
      boolean correctResponse = rules != null ? true : false;
      int httpCode = getHTTPcode(target);
      boolean correctStatus = httpCode &gt;= 200 &amp;&amp; httpCode &lt;= 300 ? true : false;
  
      assertTrue(correctStatus);
      assertTrue(correctResponse);
  }
  </code></pre>
  
  <p>I am trying to get a String from my application.properties file and insert @Value in a field in my Junit test. I have done this before in normal class, but I have null on my field in the test. I read similar questions about this problem and so far tried to create src/test/resources package and clone the application.properties there. Also tried to add the dependency </p>
  
  <pre><code>&lt;dependency&gt;
     &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
     &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
     &lt;scope&gt;test&lt;/scope&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>and add the annotation</p>
  
  <pre><code>@RunWith(SpringRunner.class)
  </code></pre>
  
  <p>I get a message No tests found with test runner Junit 5 and in Problems tab i have springboottest.jar cannot be read or is not a valid ZIP file</p>
  
  <p>Also tried </p>
  
  <pre><code>@PropertySource("classpath:application.properties")
  </code></pre>
  
  <p>as class annotation but with same result</p>
  
  <p>I did try as well to : </p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  </code></pre>
  
  <p>If i hardcode the String myUrl to "<a href="http://localhost:8090" rel="nofollow noreferrer">http://localhost:8090</a>" the test works so the problem is in the @Value not working</p>