I'd like to globally enable JSON pretty-printing for my project on my dev machine, while leaving it off on production.
What approaches could I follow?
System property. You did not specify how do you control the pretty printing now, or how do you use it, but in general you should enable/disable it based on the presence/value of some custom defined system property (standalone mode: /system-property=com.acme.enablePrettyprint=true
, domain mode: /server-group=my-group/system-property=com.acme.enablePrettyprint=true
) that you read in the component that enables/disables the feature (System.getProperty("com.acme.enablePrettyprint", "false")
).
Make it off by default and enable it explicitly on your dev environment by setting the system property in your server config.