I am writing a JSF bean using the Spring annotations instead of JSF ones. The declaration of the bean is:
The JSF_VIEW scope is the VIEW scope from JSF, and I took the implementation from HereCode:@Component @Scope(value=SpringScopes.JSF_VIEW, proxyMode=ScopedProxyMode.TARGET_CLASS) public class ListaTablaMaestraBean<ENTITY extends IBeanTablaMaestra> extends AbstractMantenimientoTablaBean<ENTITY, FiltroTablaMaestra> {
Once the page is loaded I call to the method modificaEntidadActionListener of the superclass AbstractMantenimientoTablaBean from the XHTML code.
The method modificaEntidadActionListener calls recuperaEntidadModificar() which is an abstract method implemented in the subclass. The problem is that the call to recuperaEntidadModificar() is made through a CGLIB proxy, and the method is executed in a different instance of the same class (which is annoying because field values are not initialized).Code:protected abstract ENTITY recuperaEntidadModificar(); public final void modificaEntidadActionListener(Long idElementoSeleccionado) { if (isTienePermisoModificar()) { this.idElementoSeleccionado = idElementoSeleccionado; entity = recuperaEntidadModificar(); this.cambiarEstado(EstadoTablaMantenimiento.MODIFICACION); } else { super.addMessageError(null, MSG_OPERACION_NO_PERMITIDA, MSG_OPERACION_NO_PERMITIDA); } }
To solve it, I just made an interface with all the public methods, and changed the proxy to standard java interfaces, but I'd prefer not to put interfaces in JSF beans.
Is there any way to tell CGLIB not to intercept protected methods?


Reply With Quote