title: Spring org.springframework.core.env.Environment or @Value giving null
body: <p>I am trying to load properties through <code>org.springframework.core.env.Environment</code> in my Automation project. But I am getting Environment as null. Following is my configuration.</p>
  <p>Dependencies in pom:</p>
  <pre><code>&lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
          &lt;version&gt;4.3.2.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-context&lt;/artifactId&gt;
          &lt;version&gt;4.3.2.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>
  <p><code>details.properties</code> : Placed under src/main/resources</p>
  <pre><code>group=RandomCheck
  varry=RandomMonth
  check=RandomDay
  </code></pre>
  <p>Property configuration class - TestProperty.java</p>
  <pre><code>@Configuration
  @PropertySource(&quot;classpath:details.properties&quot;)
  public class TestProperty{
      
      @Autowired
      Environment env;
  
      @Test
      public void testPro(){
        System.out.println(env.getProperty(&quot;group&quot;));
      }
  }
  </code></pre>
  <p>After executing this JUnit test I am getting null pointer because of Environment. Am I missing any configuration here or doing something wrong?</p>
  <p>I tried reading with application-context help of context:property-placeholder and @Value. Value is also returning null. Can someone help on this? Thanks.</p>