I will answer a more general question - How to implement the configuration of stored database applications well ?
, , . , CarConfig, CacheConfig, BookingConfig .., AppConfig. / .
, , ( ), / , , :
:
public interface CarConfig {
@PropertyName("default.color")
@DefaultValue("red")
String getDefaultColor();
void setDefaultColor(String color);
@PropertyName("max.size")
@DefaultValue(100)
int getMaxSize();
void setMaxSize(int size);
...
}
, . .
getters (: getDefaultColor()) - @PropertyName. . ( ) ( getMaxSize() int) .
. @PropertyName - .
, , , :
CarConfig carConfig = configs.get(CarConfig.class);
String defaultColor = carConfig.getDefaultColor();
? - , , , , , . , .
:
| key |value |
...
|"default.color"|"blue"|
|"max.size" |"85" |
...
, - getter setter - - .
CUBA - https://www.cuba-platform.com/.
, , :