Using variables in configuration files
You can use variables in the configuration to avoid hardcoding values that might not be appropriate when the configuration is reused in different environments.
About this task
Variables can be defined by setting a property in any of the following places:
- in the server configuration file, or an included file
- in the bootstrap.properties file
The following predefined variables can be referenced:
- directory properties
- JVM system properties
- process environment variables
If the same variable is specified in multiple places, the precedence is as follows:
- variables in bootstrap.properties override the process environment variables
- variables in server.xml, or included XML files, override the variables in bootstrap.properties and process environment variables
Best practice: Variables that are specific to a particular server, for
example port numbers, are specified in the bootstrap.properties file, allowing
the server.xml to be shared across multiple servers while you keep those values
different in each server. Variables that are shared across a group of servers, for example database
configuration for a particular host, is better specified in an xml file that is included into the
parent configuration file.
Best practice: Variable names must begin with an alphabetic character,
and must contain the following characters only: alphabetic characters, numeric characters, and the
"_" and "." characters.