java - How can I use Spring 3.2.3 JavaConfig to read an environment variable? -
i trying use spring 3.2.3 release javaconfig in app , need read value of environment variable.
i have read javaconfig 1.0.0.m4 documentation seems need cannot find how import or resolve referenced @environmentvaluesource
or @externalvalue
annotations.
can show me how please? thanks.
you should able use @value annotation spel expression retrieve environmental variable systemenvironment
properties object, e.g.:
@value("#{ systemenvironment['my_property'] }") private string myproperty;
if need system properties, use systemproperties['my_property']
instead.
additionally, documentation should looking @ here - have linked quite old.
Comments
Post a Comment