开发者

Injecting property values via Spring by Environment

I have a Property File like this:

frame.server.dev=mark.is.cool
frame.server.test=chris.is.cool
frame.server.qa=mitch.is.cool
frame.server.prod=cory.is.cool

I need to inject the correct value based on the environment. Since we have one ear file that we move from environment to environment, I need to do something like this:

<util:properties id="props" location="classpath:ILog-application.properties"/>

and then:

@Value ("props.frame.ser开发者_如何转开发ver.#{systemProperties.the.environment}")
private String server;

However, I cannot get systemProperties to work, nor can I get it to inject anything after a constant. Any help?


It should be

@Value ("#{props['frame.server.' + systemProperties['the.environment']]}")
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜