1.yml中写自己定义的一些固定值,定义为一个数组:
system:
default-role:
- SUPER_ADMIN
- DEVICE_WB_LEADER_ROLE
- WEIXIU_ROLE
- WX_TEAM_LEADER
- FAULT_AUDIT_ROLE
- FAULT_PINDOWN_ROLE
- XY_VERIFICATION_ROLE
- DEVICE_WBGCS_ROLE
2.定义到一个实体中:
@Data
@Configuration
@ConfigurationProperties(prefix = "system")
public class SystemConfiguration {
List<String> defaultRole;
}
3.将该实体注入后引用:
@Resource
private SystemConfiguration systemConfiguration;
roleCodeList = new ArrayList<>(systemConfiguration.getDefaultRole());
标签:定义,配置文件,FAULT,SystemConfiguration,system,ROLE,引用 From: https://www.cnblogs.com/sensenh/p/17606132.html