1. spring-mvc.xml 文件下加载配置文件(location 中是配置文件的位置)
<!-- 加载配置属性文件 -->
<context:property-placeholder ignore-unresolvable="true" location="classpath:config.properties" />
2. 类中使用注解(读取对应的属性)
@Value("${http_base_url}")
private String http_base_url;
1. spring-mvc.xml 文件下加载配置文件(location 中是配置文件的位置)
<!-- 加载配置属性文件 -->
<context:property-placeholder ignore-unresolvable="true" location="classpath:config.properties" />
2. 类中使用注解(读取对应的属性)
@Value("${http_base_url}")
private String http_base_url;