myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gerald Müllan" <>
Subject Re: savin state of beans with injected spring objects
Date Wed, 20 Sep 2006 10:36:25 GMT
The problem is that after deserialization the former injected spring
beans are also deserialized to the bean saved with t:saveState, but
this deserialized spring beans are nonsense.

You have to take care that after deserialization the spring beans are
injected the "normal" way. We did this by marking spring beans as

private transient ServiceBean _serviceBean;


and implemented the method readResolve() (called after deserialization):

public Object readResolve() throws ObjectStreamException
    return TransientFieldsInjector.inject(this);

The injector has to get the bean from the spring BeanFactory and call
the corresponding setter to inject it "manually". But maybe there are
also other solutions. We did it and it works very fine in combination
with t:saveState.

Hope this helps,



On 9/20/06, Sławek Sobótka <> wrote:
> i want to save state (using t:saveState) of my backing bean. problem
> is that my backing bean has injected by springvariableresolver somme
> business logic beans (transaction proxies).
> i get exception:
> org.springframework.beans.factory.
> support.DefaultListableBeanFactory
> i guess taht my bussiness logic bean wrapped by transaction proxy
> contains sommething that is not serializable...?
> how do You guys workaround this kinds of problems?
> i can obviously get rid of dependency incjection in my faces config
> and get business beans from spring context in every action method, but
> i dont like this solution:P
> Slawek s.
> ----------------------------------------------------
> Oglądaj -> -> Wiesz, co najważniejsze!
> Najbardziej aktualne materiały filmowe - Kliknij:


Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces
View raw message