Ramesh KC
Ramesh KC

Reputation: 582

Spring Environment Variable

I was planning to use @Value annotation to my service implementation class.

 @Value("${some_property:default_value}")
 private String key;

To use above annotation, I can use @Autowiredannotation.

 @Autowird
 Private Environment environment;

But, I am planning to use those setting in my applicationContext.xml file, which is something like following below.

<context: something missing here = "ENVIRONMENT"/>

Upvotes: 2

Views: 113

Answers (1)

soorapadman
soorapadman

Reputation: 4509

Yes. You can do it in applicationContext.xml beans tag itself there is a property called profile So you can do profile="ENVIRONMENT" in latest spring version.

Upvotes: 1

Related Questions