Search code examples
springjsfmanaged-bean

Using spring with objects injected via JSF


I have a large existing application with a bunch of managed-beans that are injected via JSF's ioc.

I want to start autowiring things into these beans. Currently i cannot do so because these beans are not created via spring.

What is the easiest way to solve this problem?


Solution

  • You can make spring get control over JSF injection by using a special EL Resolver (in faces-config.xml):

    <el-resolver>
       org.springframework.web.jsf.el.SpringBeanFacesELResolver
    </el-resolver>
    

    If you are using JSF 2.0, it's advisable that you try CDI (Contexts and Dependency Injection)