How Wildfly uses the expression evaluator to evaluate attributes

In WildFly expressions are mechanism that enables you to support variables in your attributes. A typical usage is that you want the value of attribute to be resolved using System or Environment properties.

An example expression is:

${jboss.bind.address.management:127.0.0.1}

This means that the value should derive from a system property named jboss.bind.address.management and if it is not defined use as fallback 127.0.0.1.

Expression types are supported:

  • System properties, which are resolved using java.lang.System.getProperty(String key)
  • Environment properties, which are resolved using java.lang.System.getEnv(String name).
  • Security vault expressions, resolved against the security vault configured for the server or Host Controller that needs to resolve the expression.

In all cases, the syntax for the expression is

${expression_to_resolve}

What if your expression contains itself a ${...} expression ? Then in order to avoid the expansion of the property you need to use an extra dollar sign: $${property}

If you are interested in reading just environment variables with WildFly, then check this tutorial: How to use environment variables in WildFly configuration (standalone.xml or host.xml)

Found the article helpful? if so please follow us on Socials