Class PropertyVar


public class PropertyVar extends DefaultingVar
Unified property variable resolver.

The format for this var is "$P{propertyName[,defaultValue]}".

Caller-scoped property sources:

Resolution consults the singleton Settings chain by default. Callers (notably the @Value injection path) that need to inject additional, caller-scoped PropertySources in front of the global chain can attach them to the VarResolverSession as a session bean of type PropertySource[]:

session.bean(PropertySource[].class, new PropertySource[] { source1, source2 });

When the session carries that bean, this var consults the array in order between the local/global override stores (which still win — matching the existing test-override contract) and the regular Settings sources chain. Sources earlier in the array take precedence over sources later in the array. The contract is identical to today when no such session bean is attached.

  • Field Details

  • Constructor Details

  • Method Details

    • resolve

      public String resolve(VarResolverSession session, String key)
      Description copied from class: Var
      The interface that needs to be implemented for subclasses of SimpleVar.
      Specified by:
      resolve in class Var
      Parameters:
      session - The session object used for a single instance of a var resolution.
      key - The inside argument of the variable.
      Returns:
      The resolved value.