Return-Path: Delivered-To: apmail-roller-user-archive@www.apache.org Received: (qmail 51206 invoked from network); 14 May 2007 22:43:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 14 May 2007 22:43:28 -0000 Received: (qmail 61465 invoked by uid 500); 14 May 2007 22:43:34 -0000 Delivered-To: apmail-roller-user-archive@roller.apache.org Received: (qmail 61439 invoked by uid 500); 14 May 2007 22:43:34 -0000 Mailing-List: contact user-help@roller.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@roller.apache.org Delivered-To: mailing list user@roller.apache.org Received: (qmail 61430 invoked by uid 99); 14 May 2007 22:43:34 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 May 2007 15:43:34 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (herse.apache.org: local policy) Received: from [206.248.154.182] (HELO ironport2-out.pppoe.ca) (206.248.154.182) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 May 2007 15:43:26 -0700 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao8CABiDSEZBJ8Tu/2dsb2JhbAA X-IronPort-AV: E=Sophos;i="4.14,532,1170651600"; d="scan'208";a="710281" Received: from smtp.pppoe.ca ([65.39.196.238]) by ironport2-out.pppoe.ca with ESMTP; 14 May 2007 18:43:02 -0400 Received: from [127.0.0.1] ([206.248.190.139]) by smtp.pppoe.ca (Internet Mail Server v1.0) with ESMTP id TBF91003; Mon, 14 May 2007 18:43:03 -0400 Message-ID: <4648E605.9080406@balazuc.net> Date: Mon, 14 May 2007 18:43:17 -0400 From: Denis Balazuc User-Agent: Thunderbird 2.0.0.0 (Windows/20070326) MIME-Version: 1.0 To: raphael.pieroni.dexem@gmail.com CC: user@roller.apache.org Subject: Re: Using Spring AOP around roller classes References: <4642D9F7.2050608@gmail.com> In-Reply-To: <4642D9F7.2050608@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Antivirus: avast! (VPS 000740-0, 05/13/2007), Outbound message X-Antivirus-Status: Clean X-Virus-Checked: Checked by ClamAV on apache.org Hi Raphael You can set interceptors with Spring using the BeanNameAutoProxyCreator and its friends (they are other techniques but that's the one I know/use the most) The example below wraps a "blog.dao.blogManagerDAO" bean (defined elsewhere in the Spring config) with a transaction interceptor named "blog.dao.transactionInterceptor", which is an interceptor bean also defined elsewhere. The BeanNameAutoProxyCreator (Spring) class contains properties "interceptorNames", and "beanNames" which tell it which objects methods calls you want to wrap with which interceptors. There is probably classes in Spring for selecting which methods to intercept too, and other exotic things. Example: blog.dao.transactionInterceptor blog.dao.blogManagerDAO So, basically, what you need to do is identify the bean in the Spring config on which you want to set an interceptor. Create an interceptor class with the behaviour you want to add, then use a BeanNameAutoProxyCreator bean (or other Spring interceptor-related candy) to set the interceptors when Spring creates its beans. Please do not hesitate to contact me if you need more details. Denis Balazuc Rapha�l Pi�roni wrote: > Hi, > > I would like to add a new behaviour just after a weblog entry is saved. > It seems to me that this should be achieved using spring aop. > > But, i must admit not knowing anything to spring. (but aop > concepts are known to me - once i played with aspectj) > > Can you please tell me how to do it? > My only need is to create an after-advice on the > WeblogManager.saveWeblogEntry(entry) method. > > Many thanks in advance for any help. > > Regards, > > > Rapha�l > > > > ================================================================================ > > > Les donn�es et renseignements contenus dans ce message sont personnels, > confidentiels et secrets. Ce message est adress� � l'individu ou > l'entit� dont les coordonn�es figurent ci-dessus. Si vous n'�tes pas le > bon destinataire, nous vous demandons de ne pas lire, copier, utiliser > ou divulguer ce message. Nous vous prions de notifier cette erreur � > l'exp�diteur et d'effacer imm�diatement ce message de votre syst�me. > > The information contained in this message is privileged, confidential, > and protected from disclosure. This message is intended for the > individual or entity addressed herein. > If you are not the intended recipient, please do not read, copy, use or > disclose this communication to others. > Also please notify the sender by replying to this message, and then > delete it from your system. > > ================================================================================ > >