import org.springframework.beans.factory.annotation.Value;
public class PropertyReader {
@Value("${spring.active.profiles")
private String profile;
@Nonnull
public String getProfile() {
return profile;
}
}
and this is test I have
public class PropertyReaderTest {
@Test
public void testGetProfile() throws Exception {
System.out.printf(System.getProperty("spring.active.profiles"));
assertEquals("development", new PropertyReader().getProfile());
}
}
and the dependency I have is
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.0.3.RELEASE</version>
</dependency>
</dependencies>
and I see
development
java.lang.AssertionError:
Expected :development
Actual :null