简体   繁体   中英

How to escape ${…} (so they are not evaluated as expressions) in properties files in Wildfly/Thorntail

I'm starting a Thorntail hollowjar and passing in --properties=environment.properties . This file contains a property with a ${...} expression that is not meant for Thorntail to evaluate, but rather for my application to consume as is. However, Thorntail bombs out with an error:

[org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: (("system-property" => "myPropertyName")) - failure description: "WFLYCTL0211: Cannot resolve expression 'My property value with ${expression}'"

How do I escape the ${...} so that it will be interpreted literally? Or can I globally disable expression evaluation in system properties somehow? I've Googled everywhere, but nothing about this seems to be documented.

OK, so after looking in the code ( org.jboss.as.controller.ExpressionResolverImpl ) I saw that two dollar signs are replaced by one, so to avoid expression expansion, instead of ${abc} , do $${abc} .

Why they thought it was a good idea to write their own expression evaluator when there are already many good ones out there is beyond me ¯\\_(ツ)_/¯

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM