I\'ve the below JSF managed bean:
package com.example;
import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import org.springframework.beans.factor
You cannot mix annotations and contexts like you're attempting here.
First, to inject a Spring bean (or really, any bean) into a JSF managed bean, use the @ManagedProperty
annotation. So, if everything else is setup properly (Spring-wise, including the Spring Faces EL resolver), you should have:
@ManagedProperty("#{someService}")
private SomeService someService;
When you declare a class as a @ManagedBean
, it's outside the context of Spring. As a result, @Autowired
has no power here; spring cannot inject anything into anything that's outside of its context.
If you want to use the pair of @Component
and @Autowired
, you need to remove @ManagedBean
so that it becomes a Spring managed bean instead of a JSF managed bean.