spring @Value("${name}")使用

在springmvc.xml配置文件中加入 (注意是springmvc配置文件不是spring配置文件的xml)不然可能取不到值

<context:property-placeholder location="classpath*:conf/*.properties"/>

使用格式

@Value("${server.url}")

private String url ;

原文地址:https://www.cnblogs.com/yzlsthl/p/8610542.html