So, I have a simple properties file with the following entries:
my.value=123
another.value=hello world
This properties file is being loaded using a PropertyPlaceHolderConfigurer
, which references the properties file above.
I have the following class, for which I'm trying to load these properties in to like so:
public class Config
{
@Value("${my.value}")
private String mValue;
@Value("${another.value}")
private String mAnotherValue;
// More below...
}
The problem is that, mValue
and mAnotherValue
are ALWAYS null... yet in my Controllers, the value is being loaded just fine. What gives?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…