@Configuration
@ComponentScan
@PropertySource("classpath:tests.properties")
public class SomeConfig {
@Value("${platformVersion}")
private String platformVersion;
@Resource
private Environment environment;
@Bean
public static PropertySourcesPlaceholderConfigurer propertyConfig() {
return new PropertySourcesPlaceholderConfigurer();
}
}
The platformVersion and environment are always null. In the logs: Adding [class path resource [tests.properties]] PropertySource with lowest search precedence. I saw other posts on stackoverflow (Autowired Environment is null), I do not want to go with implementing EnvironmentAware. Changing private to public for Environment does not solve the problem. Any other ideas are welcome!