public class HFtest {
@Value("${HF}")
private String HF;
@Test
public void hf(){
System.out.println(HF);
}
}
applicationContext.xml
classpath:resource.properties
public class HFtest {
@Value("${HF}")
private String HF;
@Test
public void hf(){
System.out.println(HF);
}
}
applicationContext.xml
classpath:resource.properties
<!-- 读取属性文件,否则 java 类无法直接读取属性 -->
<context:property-placeholder location="classpath:app.properties"/>