I would like to inject constant string message to managed bean in JSF web application using CDI, here is producer class:
@Named
@RequestScoped
public class StringProducer {
@Produces
@Named("message")
@RequestScoped
public String getMessage() {
return "Hello World";
}
}
and here is how it is injected in another managed bean:
@Inject Named("message") String message;
but this always result in exception:
org.jboss.weld.exceptions.UnproxyableResolutionException: WELD-001435 Normal scoped bean int is not proxyable
I tried to wrap String type within Instance like this:
@Inject Named("message") Instance<String> message;
but nothing changed.