Search in sources :

Example 1 with PropertyNotWritableException

use of javax.el.PropertyNotWritableException in project spring-framework by spring-projects.

the class SpringBeanFacesELResolver method setValue.

@Override
public void setValue(ELContext elContext, Object base, Object property, Object value) throws ELException {
    if (base == null) {
        String beanName = property.toString();
        WebApplicationContext wac = getWebApplicationContext(elContext);
        if (wac.containsBean(beanName)) {
            if (value == wac.getBean(beanName)) {
                // Setting the bean reference to the same value is alright - can simply be ignored...
                elContext.setPropertyResolved(true);
            } else {
                throw new PropertyNotWritableException("Variable '" + beanName + "' refers to a Spring bean which by definition is not writable");
            }
        }
    }
}
Also used : PropertyNotWritableException(javax.el.PropertyNotWritableException) WebApplicationContext(org.springframework.web.context.WebApplicationContext)

Aggregations

PropertyNotWritableException (javax.el.PropertyNotWritableException)1 WebApplicationContext (org.springframework.web.context.WebApplicationContext)1