My Spring boot app has this application structure:
- src
- main
- java
- resources
- application.properties
- main
This is my application.properties file:
logging.level.org.springframework=TRACE
logging.level.org.hibernate=ERROR
spring.resources.chain.strategy.content.enabled=true
spring.resources.chain.strategy.content.paths=/**
#spring.resources.chain.cache=false
#spring.resources.chain.html-application-cache=false
#spring.headers.cache=false
language=java
I have a class which requires the use of that language=java property. This is how I am trying to use it:
public class EntityManager {
@Value("${language}")
private static String newLang;
public EntityManager(){
System.out.println("langauge is: " + newLang);
}
}
That printed value is always "null" for some reason! I have also tried putting this on top of the class declaration:
@PropertySource(value = "classpath:application.properties")