JUNEAU-174 Allow configuration properties to be set globally
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java
index 7cca861..0e005d8 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java
@@ -240,6 +240,16 @@
if (s != null)
return PropertyStoreBuilder.MutableProperty.create(k, s).build();
+ try {
+ String ke = key.replace('.', '_');
+ s = System.getenv(ke);
+ if (s != null)
+ return PropertyStoreBuilder.MutableProperty.create(k, s).build();
+ s = System.getenv(ke.toUpperCase());
+ if (s != null)
+ return PropertyStoreBuilder.MutableProperty.create(k, s).build();
+ } catch (SecurityException e) {}
+
return null;
}
diff --git a/juneau-doc/docs/ReleaseNotes/8.1.3.html b/juneau-doc/docs/ReleaseNotes/8.1.3.html
index 05cb78c..c8f5748 100644
--- a/juneau-doc/docs/ReleaseNotes/8.1.3.html
+++ b/juneau-doc/docs/ReleaseNotes/8.1.3.html
@@ -25,6 +25,12 @@
Better representation of nulls for XML and HTML content properties.
<br>Old: <js>"<myBean><null></myBean>"</js>
<br>New: <js>"<myBean nil='true'></myBean>"</js>
+ <li>
+ Configurable properties such as {@link oaj.BeanContext#BEAN_debug} can now be set globally by either
+ system properties or environment variables.
+ <br>For <jsf>BEAN_debug</jsf> which resolves to <js>"BEAN_debug"</js>, you can use either the system
+ property <js>"BeanContext.debug.b"</js> or environment variables <js>"BeanContext_debug_b"</js> or
+ <js>"BEANCONTEXT_DEBUG_B"</js>.
</ul>
<h5 class='topic w800'>juneau-rest-server</h5>
diff --git a/juneau-doc/docs/Topics/02.juneau-marshall/06.ConfigurableProperties.html b/juneau-doc/docs/Topics/02.juneau-marshall/06.ConfigurableProperties.html
index d8e5c8f..1fcc51a 100644
--- a/juneau-doc/docs/Topics/02.juneau-marshall/06.ConfigurableProperties.html
+++ b/juneau-doc/docs/Topics/02.juneau-marshall/06.ConfigurableProperties.html
@@ -13,7 +13,7 @@
***************************************************************************************************************************/
-->
-Configurable Properties
+{updated} Configurable Properties
<p>
Serializers and parsers have a wide variety of configurable properties. They all extend from the
@@ -78,8 +78,13 @@
<p class='bpcode w800'>
<jc>// Clone and customize an existing serializer.</jc>
WriterSerializer s = SimpleJsonSerializer.<jsf>DEFAULT</jsf>
-
.builder() <jc>// Create a new builder with copied settings.</jc>
.quoteChar(<js>'"'</js>) <jc>// Use a different quote character.</jc>
.build();
</p>
+<p>
+ Configurable properties can be set globally using either system properties or environment variables.
+ <br>For example, the <jsf>WSERIALIZER_useWhitespace</jsf> variable resolves to the string <js>"WriterSerializer.useWhitespace.b"</js>.
+ This setting can be enabled by setting the system property <js>"WriterSerializer.useWhitespace"</js> or environment
+ variables <js>"WriterSerializer_useWhitespace"</js> or <js>"WRITERSERIALIZER_USEWHITESPACE"</js> to <js>"true"</js>.
+</p>