jsf 2 - Does AOP with AspectJ works with method from Managed Bean called from the view in JSF2? -


i’m facing problem using combination of jsf 2 , aop aspectj annotation. don't know if spring aop playing role here...(i didn't understand difference between spring aop, aspectj, google guice...that's question)

i'm trying send e-mail after added values in database via click on form in jsf view. have managedbean addpartipant handled jsf (linked view) add participant via form. want intercept method makes change in database , send email after action. have spring bean sendmailboimpl method send email.(sending works ok)

i found using aop way. it's works when trying make works in main...not in complete webapp. read stuffs problem context spring / jsf don't found solution...yet...

i know method add data in database via view ok...but mail never sent whereas database modified.

somebody has idea ?

thanks lot :)

addparticipant managedbean :

     public class addparticipant  implements serializable{      //di via spring     participantbo participantbo;      private string  id_study ;      private participant  aparticipant = new participant();              //getters , setters      public void addparticipant(){          aparticipant.setid_study (id_study);         ...         participantbo.save(aparticipant);          facescontext.getcurrentinstance().addmessage(null, new facesmessage("ajout du participant "+id_study+" dans l'étude "+ study_name));      } 

maibo service :

      @after("execution(* com.clb.genomic.lyon.beans.addparticipant.addparticipant(..))")      public void sendmail() {            ....          mailsender.send(message);             ....      }   

my bean config :

 <aop:aspectj-autoproxy proxy-target-class="true" />  <bean id="addparticipant" class="com.clb.genomic.lyon.beans.addparticipant"/>  <bean id="sendmailbo" class="com.clb.genomic.lyon.bo.sendmailboimpl">     <property name="mailsender" ref="mailsender" />     <property name="simplemailmessage" ref="customemailmessage" /> </bean> 

when it's working :

     applicationcontext appcontext =  new classpathxmlapplicationcontext       ( "classpath:webconfiguration/applicationcontext.xml");       addparticipant aspect = (addparticipant) appcontext.getbean("addparticipant");       aspect.addparticipant(); 

solved base on read of : http://kumarnvm.blogspot.fr/2012/07/using-spring-to-manage-jsf-september-10_14.html


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -