@PropertySource配合@ConfigurationProperties获取配置文件的元素
@PropertySource(value ={"classpath:person.properties"} )
@ConfigurationProperties(prefix = "person")
@ImportResource
在启动类中导入配置文件(Spring的自定义配置文件等)
@ImportResource(value = {"classpath:beans.xml"})
@Configration 配置类
@Bean 装备bean
@Configuration
public class AppConfig {
@Bean
public HelloService helloService(){
return new HelloService();
}
}