aspectj - Spring AOP Pointcut not called -


i work jsf 2.2 + spring framework 3.2.4

so, have applicationcontent.xml

<beans xmlns="http://www.springframework.org/schema/beans"       xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"        xmlns:context="http://www.springframework.org/schema/context"       xmlns:tx="http://www.springframework.org/schema/tx"       xmlns:aop="http://www.springframework.org/schema/aop"       xmlns:p="http://www.springframework.org/schema/p"       xsi:schemalocation="http://www.springframework.org/schema/beans         http://www.springframework.org/schema/beans/spring-beans-3.2.xsd         http://www.springframework.org/schema/aop         http://www.springframework.org/schema/aop/spring-aop-3.2.xsd          http://www.springframework.org/schema/context         http://www.springframework.org/schema/context/spring-context-3.2.xsd          http://www.springframework.org/schema/tx          http://www.springframework.org/schema/tx/spring-tx.xsd">      <aop:aspectj-autoproxy proxy-target-class="true" />     <tx:annotation-driven transaction-manager="transactionmanager"/>     <context:annotation-config/>     <context:component-scan base-package="com.vulcan.controller" />     <context:component-scan base-package="com.vulcan.service" />     <context:component-scan base-package="com.vulcan.dao" />     <context:component-scan base-package="com.vulcan.spring.aop" />  ..... 

then have aspect component in

package com.vulcan.spring.aop;  @aspect public class loggingservice {     private log log = logfactory.getlog(this.getclass());      @pointcut("execution(* *.*(..))")     protected void loggingoperation() {}      @before("loggingoperation()")     public void logjoinpoint()     {         system.out.println ("hello");      }    .... 

with type of execution assume pointcut triggered on every methods. problem is, pointcut isn't triggered ? idea why ? thanks

fyi, using glassfish 4, , when deploy web app didn't receive error configuration. assume configuration fine.

@aspect annotate classes aren't automatically detected spring , because isn't detected isn't known <aop:aspectj-autoproxy /> beans. there no aspect.

either add @component @aspect annotated class(es) spring can detect , use aspect.

@compopnent @aspect public class loggingservice { ... } 

or declare aspect explictly in xml file

<bean class="loggingservice" /> 

either way aspect picked <aop:aspectj-autoproxy /> beans , advice run.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -