Class springBeanFacesELResolver

java.lang.Object
jakarta.el.ELResolver
org.springframework.web.jsf.el.springBeanFacesELResolver

public class springBeanFacesELResolver extends jakarta.el.ELResolver
JSF ELResolver that delegates to the spring root WebApplicationContext, resolving name references to spring-defined beans.

Configure this resolver in your faces-config.xml file as follows:

<application>
  ...
  <el-resolver>org.springframework.web.jsf.el.springBeanFacesELResolver</el-resolver>
</application>
All your JSF expressions can then implicitly refer to the names of spring-managed service layer beans, for example in property values of JSF-managed beans:
<managed-bean>
  <managed-bean-name>myJsfManagedBean</managed-bean-name>
  <managed-bean-class>example.MyJsfManagedBean</managed-bean-class>
  <managed-bean-scope>session</managed-bean-scope>
  <managed-property>
    <property-name>myspringManagedBusinessObject</property-name>
    <value>#{myspringManagedBusinessObject}</value>
  </managed-property>
</managed-bean>
with "myspringManagedBusinessObject" defined as spring bean in applicationContext.xml:
<bean id="myspringManagedBusinessObject" class="example.MyspringManagedBusinessObject">
  ...
</bean>
Since:
2.5
Author:
Juergen Hoeller
See Also:
  • Constructor Details

    • springBeanFacesELResolver

      public springBeanFacesELResolver()
  • Method Details

    • getValue

      public @Nullable Object getValue(jakarta.el.ELContext elContext, @Nullable Object base, Object property) throws jakarta.el.ELException
      Specified by:
      getValue in class jakarta.el.ELResolver
      Throws:
      jakarta.el.ELException
    • getType

      public @Nullable Class<?> getType(jakarta.el.ELContext elContext, @Nullable Object base, Object property) throws jakarta.el.ELException
      Specified by:
      getType in class jakarta.el.ELResolver
      Throws:
      jakarta.el.ELException
    • setValue

      public void setValue(jakarta.el.ELContext elContext, @Nullable Object base, Object property, Object value) throws jakarta.el.ELException
      Specified by:
      setValue in class jakarta.el.ELResolver
      Throws:
      jakarta.el.ELException
    • isReadOnly

      public boolean isReadOnly(jakarta.el.ELContext elContext, @Nullable Object base, Object property) throws jakarta.el.ELException
      Specified by:
      isReadOnly in class jakarta.el.ELResolver
      Throws:
      jakarta.el.ELException
    • getCommonPropertyType

      public Class<?> getCommonPropertyType(jakarta.el.ELContext elContext, @Nullable Object base)
      Specified by:
      getCommonPropertyType in class jakarta.el.ELResolver
    • getWebApplicationContext

      protected WebApplicationContext getWebApplicationContext(jakarta.el.ELContext elContext)
      Retrieve the web application context to delegate bean name resolution to.

      The default implementation delegates to FacesContextUtils.

      Parameters:
      elContext - the current JSF ELContext
      Returns:
      the spring web application context (never null)
      See Also: