@ConfigurationProperties配合@PropertySource进行配置文件数据注入
@PropertySource的单独使用
单独使用时需配合@value进行注入
自定义配置文件
demo.list=1,2,3,4
demo.name=zhangsan
value为配置文件路径,encoding 为编码格式
ignoreResourceNotFound为当文件不存在是否报错,false为报错
代码
package com.channelsoft.utils;
import org.springframework.beans.factory.annotation.Value;
imp
原创
2021-02-20 15:55:52 ·
295 阅读 ·
1 评论