@Qualifier @Retention(value=RUNTIME) @Target(value={METHOD,FIELD,PARAMETER}) public @interface ContextParam
The CDI annotation @
ContextParam
allows you to inject a web.xml
context
parameter from the current application in a CDI managed bean. It's basically like
@ManagedProperty("#{initParam['some.key']}") private String someKey;
in a "plain old" JSF managed bean.
By default the name of the context parameter is taken from the name of the variable into which injection takes place.
The example below injects the context parameter with name foo
.
@Inject @ContextParam private String foo;
The name can be optionally specified via the name
attribute, which shall more often be used as context
parameters may have a.o. periods and/or hyphens in the name, which are illegal in variable names.
The example below injects the context parameter with name foo.bar
into a variable named bar
.
@Inject @ContextParm(name="foo.bar") private String bar;
ContextParamProducer
public abstract String name
Copyright © 2012–2016 OmniFaces. All rights reserved.