2.4.2. Descriptor-based Property Replacement

Application configuration - for example, datasource connection parameters - typically varies between development, testing, and production deployments. This variance is sometimes accommodated by build system scripts, as the Java EE specification does not contain a method to externalize these configurations.
With JBoss Enterprise Application Platform 6 you can use Descriptor-based property replacement to manage configuration externally.
Descriptor-based property replacement substitutes properties based on descriptors, allowing you to remove assumptions about the environment from the application and the build chain. Environment-specific configurations can by specified in deployment descriptors rather than annotations or build system scripts. You can provide configuration in files or as parameters at the command line.
Descriptor-based property replacement is enabled globally through standalone.xml or domain.xml:
<subsystem xmlns="urn:jboss:domain:ee:1.1">
Java EE descriptors in ejb-jar.xml and persistence.xml can be replaced. By default this is disabled.
JBoss-specific descriptor replacement is enabled by default. Descriptors can be replaced in:
  • jboss-ejb3.xml
  • jboss-app.xml
  • jboss-web.xml
  • *-jms.xml
  • *-ds.xml
For example, given a Bean with the following annotation:
 @ActivationConfigProperty(propertyName = "connectionParameters", propertyValue = "host=;port=5445")
With descriptor-based property replacement enabled, the connectionParameters can be specified via the command-line as:
./standalone.sh -DconnectionParameters='host=;port=5445'
To accomplish the same via system properties:
${jms.connection.parameters:'host=;port=5445'} allows the connection parameters to be overridden by a command-line supplied parameter, while providing a default value.