> AJCT Project > Home > Usage |
|
AJCT – Another Java Configuration ToolStartup parametersBy default, AJCT looks for the file <hostname>.config.xml in the classpath. If required, any source can be used as initial configuration source. All that is required is to specify it at the command line. Note: the default namespace is 'config'.
The other parameters are as described for the given configuration source, prepended with the namespace. Example 1: use the xml file 'development.config.xml' located in the class path of the JVM.
Example 2: use the system properties starting with 'myapp'. Load them into the section 'system'.
Example 3: use the xml file 'C:\config\test.config.xml'.
InitializationAJCT supports both explicit and lazy initialization. LazyIf you use AJCT (any call to ConfigManager except init) before explicit initialization, AJCT is initialized lazy. ExplicitExplicit initialization uses a call to init() prior to any other call.
init() needs an AjctConfiguration configuration object. This can be the default (AjctConfiguration.getDefaultAjctConfig()) or one that you configured by coding:
Difference between lazy and explicit Beyond the obvious difference of being able to configure AJCT, the biggest difference is that you are unable to trap errors when AJCT fails to initialize when using lazy initialization. Substitution (and how to escape them)Reusing parts of your configuration is one of the powers of AJCT. In order to achieve this, AJCT supports substitution in the values. The syntax for substitution is [sectionName]{keyName}
The last step after reading in the configuration is processing all substitutions (except for parameters for 'include' or 'export' statements). Pitfalls:
|
This file was last modified