application.yml变量列表
dictionary:
category: CATEGORY_CODE
dataTypeList:
- name: 字符串
code: STRING
- name: VARCHAR
code: VARCHAR
parentCode: STRING
- name: CHAR
code: CHAR
parentCode: STRING
- name: BPCHAR
code: BPCHAR
parentCode: STRING
- name: TEXT
code: TEXT
parentCode: STRING
- name: MEDIUMTEXT
code: MEDIUMTEXT
parentCode: STRING
映射对象配置(核心)
要点:重写get、set方法;
- set方法(无需static修饰)设置静态变量;
- get方法(必须static修饰)
//java项目 www.fhadmin.org
@Configuration
@ConfigurationProperties(prefix = "dictionary")
public class Dictionary{
@Value("dictionary.category")
private static String category;
@Value("dictionary.dataTypeList")
private static List<DataType> dataTypeList;
public void setCategory(String formCategory) {
Dictionary.formCategory = formCategory;
}
public static String getFormCategory() {
return formCategory;
}
public void setDataTypeList(List<DataType> dataTypeList) {
Dictionary.dataTypeList = dataTypeList;
}
public static List<DataType> getDataTypeList() {
return dataTypeList;
}
}