how to enable full featured aspectj in spring

365 Views Asked by At

How I can enable the full featured aspectj in a spring project to be able to use conditional pointcuts?

Right now I have in config file:

 <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:task="http://www.springframework.org/schema/task" xmlns:aop="http://www.springframework.org/schema/aop"
   xsi:schemaLocation="
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
    http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd">

....

  <aop:aspectj-autoproxy />

but when i want to create a pointcut like this:

    @Pointcut(value = "execution(public * *(..)) && if() ")
    public static boolean  anyPrivateMethod() {
     return enabled>0;
    }

there is a compilation exception saying: Pointcut expression 'execution(public * *(..)) && if() ' contains unsupported pointcut primitive 'if' basically because there is spring AOP acting and not Aspecj.

So how i can use aspectj AOP and not Spring AOP?

0

There are 0 best solutions below