spring3.0 使用@value 加载配置文件property
(1)在spring配置文件中。加入
<beans xmlns:context="http://www.springframework.org/schema/context">
<context:property-placeholder location="classpath:datasource.properties,classpath:constant.properties"/>
</beans>
(2)
@Value("${url}")
private String url;
public static void main(String args[]){
System.out.println("url "+url);
}

浙公网安备 33010602011771号