In order to use the @Autowire annotation, the object where you use the annotation must come from the spring context.
JSF managed beans are created by JSF’s IOC not Springs, therefor i cannot use @Autowire inside of them must must use faces-config.xml and managed properties.
I already setup an EL resolver that lets be have spring beans as managed properties, i want to take it one step further and get rid of the need to go into the faces-config.xml every time i need to autowire something. Is this possible?
Just annotate your managed beans with
@Controller(or@Component), and@Scope("request")(orsession) and add<context:component-scan>(if you haven’t), and managed beans will automatically be detected as spring beans. And since you are already using the ELResolver, that should be it – you should be able to use@Autowired(or better –@Inject, if using spring 3.0).