Yes. Spring AOP doesn't work. This works. public class AspectJConfig { @Bean public CourseServiceMock CourseServiceAspect() { CourseServiceMock aspect = Aspects.aspectOf(CourseServiceMock.class); return aspect; } }
Thanks, Mohan On 20 September 2016 at 01:40, Andy Clement <andrew.clem...@gmail.com> wrote: > I don’t honestly know about Spring AOP and using if() like that. >From the > documentation: > > http://docs.spring.io/spring/docs/current/spring-framework- > reference/html/aop.html#aop-pointcuts-designators > > That lists the supported designators and if() is not on the list I’m > afraid. > > Could be worth asking on stack overflow about how to achieve what you want > in Spring AOP. > > cheers, > Andy > > On Sep 19, 2016, at 6:42 AM, Mohan Radhakrishnan < > radhakrishnan.mo...@gmail.com> wrote: > > Hi, > This should be supported. Isn't it. I use Spring Tool Suite > and @EnableAspectJAutoProxy > > Thanks, > Mohan > > @Pointcut("execution(* com.pearson.nextgen.enterprise > .service.CourseService.getCoursesByInstitutionId(String)) && if()") > public static boolean courseSearch() { > return Boolean.getBoolean( mockOrNot.get() ); > } > > > Caused by: org.aspectj.weaver.tools.UnsupportedPointcutPrimitiveException: > Point > cut expression 'execution(* com.pearson.nextgen.enterprise > .service.CourseService > .getCoursesByInstitutionId(String)) && if()' contains unsupported > pointcut primi > tive 'if' > at org.aspectj.weaver.tools.PointcutParser.validateAgainstSuppo > rtedPrimi > tives(PointcutParser.java:435) > at org.aspectj.weaver.tools.PointcutParser.validateAgainstSuppo > rtedPrimi > tives(PointcutParser.java:413) > at org.aspectj.weaver.tools.PointcutParser.resolvePointcutExpre > ssion(Poi > ntcutParser.java:311) > at org.aspectj.weaver.reflect.InternalUseOnlyPointcutParser.res > olvePoint > cutExpression(InternalUseOnlyPointcutParser.java:36) > at org.aspectj.weaver.reflect.Java15ReflectionBasedReferenceTyp > eDelegate > .getDeclaredPointcuts(Java15ReflectionBasedReferenceTypeDelegate.java:307) > at org.aspectj.weaver.ReferenceType.getDeclaredPointcuts(Refere > nceType.j > ava:884) > _______________________________________________ > aspectj-users mailing list > aspectj-users@eclipse.org > To change your delivery options, retrieve your password, or unsubscribe > from this list, visit > https://dev.eclipse.org/mailman/listinfo/aspectj-users > > > > _______________________________________________ > aspectj-users mailing list > aspectj-users@eclipse.org > To change your delivery options, retrieve your password, or unsubscribe > from this list, visit > https://dev.eclipse.org/mailman/listinfo/aspectj-users >
_______________________________________________ aspectj-users mailing list aspectj-users@eclipse.org To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/aspectj-users