spring - management using MB @ViewScoped -


//exemple01 @managedbean(name = "mb") @viewscoped public class exemplemb implements serializable {  @managedproperty(value = "#{servicebo}") private servicebo servicebo;   @postconstruct  public void init{  list= servicebo.list();  }  public void query(){   servicebo.query(parameters);   } } 

exemple 01: returns me error javax.faces.facesexception: java.io.notserializableexception: being can not serialized because , managed spring.

//exemple02 @managedbean(name = "mb") @viewscoped public class exemplemb implements serializable {  @managedproperty(value = "#{servicebo}") private transient servicobo servicebo;   @postconstruct  public void init{  list= servicebo.list();  }  public void query(){   servicobo.query(paramestros);   } } 

exemple 02: makes query init, method null search service, has marked transient this, how can solve problem.

spring services not serializable. instead inject fully serializable proxies, @viewscoped bean serialization happen flawlessly.

if you're using annotations, add following class definition:

@service @scope(value = "singleton", proxymode = scopedproxymode.interfaces) public yourservice { ... } 

if you're using xml, following:

<bean id="yourservice" class="your.package.yourserviceimpl" scope="singleton">     <aop:scoped-proxy proxy-target-class="false"/>     ... </bean> 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -