I'm using 2.5rc1 with LTW.
The simple test class:
The Aspect looks as follows:Code:package foo; import java.util.Map; public class Service { public void methodWithString(String string) { System.out.println("methodWithString=" + string); } public void methodWithMap(Map map) { System.out.println("methodWithMap=" + map); } }
The output is:Code:package foo; import java.util.Map; import org.aspectj.lang.annotation.*; @Aspect public class MapAspect { @Pointcut("execution(* *.methodWithString(String)) && args(string)") private void stringPointcut(String string) {} @Before("stringPointcut(string)") public void logString(String string) { System.out.println("-> String=" + string); } @Pointcut("execution(* *.methodWithMap(Map)) && args(map)") private void mapPointcut(Map map) {} @Before("mapPointcut(map)") public void logMap(Map map) { System.out.println("-> Map=" + map); } @Pointcut("execution(* *.methodWithMap(*)) && args(map)") private void mapWildcardPointcut(Map map) {} @Before("mapWildcardPointcut(map)") public void logMapWildcard(Map map) { System.out.println("-> MapWildcard=" + map); } }
The color already indicates that the String and wildcard Pointcut work fine.Code:-> String=TEST-STRING methodWithString=TEST-STRING -> MapWildcard={KEY=VALUE} methodWithMap={KEY=VALUE}
But why does the Pointcut with the exact parameter type of that method fail?
META-INF/aop.xml:
application-context.xml:Code:<!DOCTYPE aspectj PUBLIC "-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd"> <aspectj> <weaver options="-verbose"> <include within="foo.*"/> <dump within="foo.*"/> </weaver> <aspects> <aspect name="foo.MapAspect"/> </aspects> </aspectj>
Code:<?xml version="1.0" encoding="UTF-8"?> <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" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"> <bean id="service" class="foo.Service"/> <context:load-time-weaver/> </beans>


Reply With Quote