I'm trying to get a ManagedProperty injection working, where the injected bean resides in a jar included in my web application.
Bean to be injected:
@ManagedBean(name="messages")
@SessionScoped
public class Messages implements Serializable
{
Receiving bean:
@ManagedProperty(value="#{messages}")
private Messages messages;
public void setMessages(Messages messages)
{
this.messages = messages;
}
However, this doesn't work and I'm just getting the message "Unable to set property messages for managed bean". If I put the Messages class in the same package as the receiving bean instead of having it in it's own jar, it works just fine.
The JAR must contain a JSF 2.0 compliant /META-INF/faces-config.xml
file to trigger JSF 2.0 annotation scans in JAR files.
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
version="2.0">
</faces-config>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With