一、@PropertySource 加载外面资源文件
value={ "person.properties"}) ( public class SpringConfigProperty { public Person person(){ return new Person(); }
xml 加载外部资源方式
<context:property-placeholder location="classpath:spring-common.xml"/>
二、@value 赋值的使用
//使用@Value赋值; //1、基本数值 //2、可以写SpEL; #{} //3、可以写${};取出配置文件【properties】中的值(在运行环境变量里面的值) "1") ( private Integer id; "${person.nickName}") ( private String name; "#{20-2}") (