Announcement Announcement Module
Collapse
No announcement yet.
Example of serializing proxy? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Example of serializing proxy?

    I am developing a JSF2 + Spring web application. I manage view beans from spring using the scope extension mechanism as it is described here.

    The problem I have is that some of the view beans have injected services, so they are no longer Serializable. Currently I solve the problem marking the non serializable fields as transient, and I recover them using a readObject method similar to this in deserialization, but the solution is nasty and not generic:

    Code:
    	
    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    	in.defaultReadObject();
    	FacesContext facesContext = FacesContext.getCurrentInstance();
    	if (facesContext != null) { 
    		applicationContext = FacesContextUtils.getRequiredWebApplicationContext(facesContext);
    		contenedorServiciosMaestros = applicationContext.getBean(IContenedorServiciosMaestros.class);
    		mptTransferenciaMensajesAJSFHelper = applicationContext.getBean(MptTransferenciaMensajesAJSFHelper.class);
    	}
    }
    I saw this video from Arjen Poutsma

    Around 1 hour in the video, it talks about a new feature in spring 3 which is a serializing proxy, but it doesn't explain how to use it. So, the question is: How do I use/implement a generic proxy for recovering spring dependencies on deserialization?

  • #2
    Ok, I solved the problem. It was not because of serialization. I had a jstl c:if tag in one of my pages, and this seems to be problematic with JSF. I eliminated the tags, and now works ok

    Comment

    Working...
    X