spring.xml
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd "> <aop:aspectj-autoproxy /> <bean id="customerBo" class="CustomerBoImpl" /> <bean name="objTriangle" class="com.mugil.shapes.Triangle"> <property name="name" value="Triangle Name"></property> </bean> <bean name="objCircle" class="com.mugil.shapes.Circle"> <property name="name" value="Circle Name"></property> </bean> <bean id="shapeService" class="com.mugil.shapes.ShapeService" autowire="byName"/> <bean name="loggingAspect" class="com.mugil.shapes.LoggingAspect"/> <aop:config> <aop:aspect id="loggingAspect" ref="loggingAspect"> <aop:pointcut expression="execution(* com.mugil.shapes.*.get*())" id="allGetters"/> <aop:around method="LoggingAdvice2" pointcut-ref="allGetters"/> </aop:aspect> </aop:config> </beans>
spring.xml
<aop:aspect id="loggingAspect" ref="loggingAspect">
equivalent to
@Aspect public class LoggingAspect {
spring.xml
<aop:pointcut expression="execution(* com.mugil.shapes.*.get*())" id="allGetters"/>
equivalent to
@Pointcut("execution(* com.mugil.shapes.*.get*())") public void allGetters() { }
spring.xml
<aop:around method="LoggingAdvice2" pointcut-ref="allGetters"/>
equivalent to
@Around("allGetters()") public void LoggingAdvice2(ProceedingJoinPoint pjp) { . .
<aop:pointcut expression="execution(* com.mugil.shapes.*.get*())" id="allGetters"/> <aop:around method="LoggingAdvice2" pointcut-ref="allGetters"/>
could be replaced using pointCut
<aop:around method="LoggingAdvice2" pointcut="execution(* com.mugil.shapes.*.get*())"/>