I'm a little confused concerning when to use ${...}
compared to #{...}
. Spring's documentation only uses #{...}
, but there are plenty of examples that use ${...}
. Furthermore, when I started with SpEL I was told to use ${...}
and it works fine.
For those who are confused, an example of how I use it would be
@Component
public class ProxyConfiguration {
@Value("${proxy.host}")
private String host;
@Value("${proxy.port}")
private String port;
:
}
and some property file:
proxy.host=myproxy.host
proxy.port=8000
My questions are:
- what are the differences or is it the same?
- is one version deprecated so I should use the other one?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…