Skip to main content

VarResolver

The Microservice API incorporates the Simple Variable Language API.

For the default resolver and its built-in variables, see VarResolver.DEFAULT.

The variable resolver can be augmented through the following methods:

Microservice.Buildervars(Class...)varBean(Class,Object)

A typical usage pattern is shown below:

// $A used in variable resolver.
VarResolver varResolver = Microservice.getInstance().getVarResolver();
System.out.println(varResolver.resolve("Main class is set to $MF{Main-Class, unknown}"));

The variable resolver becomes much more powerful when used in REST resource annotations which will be described later in juneau-microservice-jetty. It supports the variables listed in VarResolver.DEFAULT plus $C{key[,default]} (ConfigVar) for the microservice configuration.

note

Juneau 10.0.0 removed the 11 transformation/conditional $Var{...}-style variables that previously lived here (IfVar, SwitchVar, CoalesceVar, PatternMatchVar, PatternReplaceVar, PatternExtractVar, UpperCaseVar, LowerCaseVar, NotEmptyVar, LenVar, SubstringVar) and replaced them with the #{name(args...)} function-call syntax — see #{...} Function-call Syntax for the current equivalents (e.g. #{if(...)}, #{switch(...)}, #{upper(...)}, #{lower(...)}).

See also​