一、注解
@ConfigurationProperties : { //读取配置文件,填充entity,
prefix="spring.http" ,//前缀为某一个值的属性会填充进来
}
@EnableConfigurationProperties :{// 使能配置文件配置
value = {PropertiesTest.class},//需要填充entity的类
},
@ConditionalOnProperty : {//配置属性条件编译
prefix = "spring.test",//前缀,只有配置文件包含此前缀,才运行
value = "enable",//
matchIfMissing = false://如果匹配不到是否运行,true,是,false,否
}
@ConditionalOnMissingBean :{ //条件编译,当不存在某一个bean时运行
value = {PropertiesTest.class} ,//当不存在该类是运行
}
二、配置文件属性
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss //配置responsebody的时间返回格式,避免Date类型返回到前台的时间戳