(基于SpringBoot框架企业级应用系统开发全面实战)->{02.04_常规属性配置_recv}
加载指定位置的XML文件
使用xml的配置文件;
@ImportResource
@ImportResource({"classpath:some-context.xml","classpath:another-context.xml"})
加载指定的properties文件
SpringBoot默认加载maven项目目录下的:src/main/resources/application.properties
@PropertySource指明properties文件位置;
@ConfigurationProperties(prefix="author") //限定加载文件内前缀的配置
这个测试Demo的启动类和Controller在同一个Class
@Value注解
@RestController
//组合注释
@SpringBootApplication
/**
* 关闭特点的自动配置
* @author Administrator
*
*/
/*@SpringBootApplication(exclude={DataSourceAutoConfiguration.class})
@Configuration
@EnableAutoConfiguration
@ComponentScan*/
public class Ch222Applica