i have java code i'm running jar. code checks specific file in given directory hard coded in code.
to give more flexibility , not touch code. have folers list managed different file , code reads config file , gets list of folders each time , execute it.
i know best possible option of maintaining folder list outside code can update it. can properties used ? can dynamically take values property file
in java have java.util.properties
allow load flat key/value data external resources.
if need can dynamically updated, there's more sophisticated preferences library. 1 allows to:
- keep data organized in tree structures (it's tree of nodes, each node storing own key/value preferences).
- make use of basic types (primitive types, strings , binary data).
- make use of platform-dependent "native" stores transparently (under hood, it's going use file system on unix systems , registries on windows default).
- plug in own backing store if needed.
- get data changes performed within application persisted transparently.
- register node/preference change listeners , react change if needed.
the api quite old , hasn't been updated, doesn't mean it's deprecated. used gui applications (notably, intellij idea storing configuration using preferences last time checked).
there's attempt revive library made project called cross-preferences integrating modern distributed config stores (such zookeeper, etcd or consul) backing stores java.util.prefs.preferences
, providing web console preference management.
Comments
Post a Comment