Annotation Interface Value
The value() string is passed through Juneau's VarResolver (so
${...} / $P{...} placeholders are expanded against
Settings.get()), then coerced to the
target Java type via Settings.toType(String, Class).
Examples:
Resolution order:
- Thread-local override (
Settings.setLocal) - Global override (
Settings.setGlobal) - Property sources in reverse insertion order — this is where Juneau
Config, SpringEnvironment, and any other registeredPropertySourceparticipate. - System properties
- System environment variables
Spring's org.springframework.beans.factory.annotation.Value annotation is honored identically
via FQN-based detection in JsrSupport; no compile-time Spring dependency is introduced in
juneau-commons.
Notes:
@Valueand@Injecton the same site is invalid and throws aBeanCreationException.@Valueresolves strings/primitives;@Injectresolves beans.- If the expression resolves to
nulland the target type is a primitive, aBeanCreationExceptionis thrown. For reference types,nullis injected.
See Also:
-
Required Element Summary
Required Elements
-
Element Details
-
value
The configuration expression.Typically uses the
${key}or${key:default}placeholder syntax that is routed throughVarResolverandSettings. Plain literals (no$) are passed through unchanged and still type-coerced.- Returns:
- The configuration expression.
-