myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gerald Müllan" <bierbra...@gmail.com>
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
transient:

private transient ServiceBean _serviceBean;

//Setter

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,

cheers,

Gerald

On 9/20/06, Sławek Sobótka <ssobot@wp.pl> 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:
> java.io.NotSerializableException: 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 -> Wydarzenia.wp.pl -> Wiesz, co najważniejsze!
> Najbardziej aktualne materiały filmowe - Kliknij:
> http://klik.wp.pl/?adr=www.wydarzenia.wp.pl&sid=876
>
>
>


-- 
http://www.irian.at

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

Professional Support for Apache MyFaces
Mime
View raw message