dev@glassfish.java.net

hk2 enhancement

From: Justin Lee <justin.d.lee_at_oracle.com>
Date: Wed, 24 Mar 2010 10:07:09 -0400

In grizzly, especially, we have several cases where we don't define
default values on configuration properties because we need to be able to
support various system properties. If the config value is null, we
check System.getProperties(). If both are null, we apply a hard coded
default value. This is cumbersome and problematic and makes it hard to
document what the default value actually is. It also What I propose is
to extend the Attribute annotation to take an option system property
name and perhaps some precedence. If the value of the attribute is null
(or is equal to the default value), the system property is checked to
see if it's been set. If the attribute uses the default value and the
system property is set, the precedence value is used to determine which
value is applied.

As distasteful as using system properties is, we need to support them in
a number of areas for legacy support reasons. This enhancement would
allow us to declaratively define what system properties are supported
where. This would be massive gain in both code needed to support such
arrangements and documentation for our users. What do you think?