切入点前pression“ABC(inString)”包含不支持的切入点原始的“来电” [英] Pointcut expression 'abc(inString)' contains unsupported pointcut primitive 'call'

查看:558
本文介绍了切入点前pression“ABC(inString)”包含不支持的切入点原始的“来电”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的弹簧AOP概念。

I am new to spring-aop concepts.

我在编译过程中收到此错误。

I am getting this error during compilation.

org.aspectj.weaver.tools.UnsupportedPointcutPrimitiveException:
  切入点前pressionABC(inString)包含不支持的切入点
  原始的呼叫

org.aspectj.weaver.tools.UnsupportedPointcutPrimitiveException: Pointcut expression 'abc(inString)' contains unsupported pointcut primitive 'call'

我的方面是,

@Aspect
@Component
public class BeforeAdvice {

      @Pointcut(value="call(@com.app.test.EncryptDemo * *(String)) && args(inString) && !within(com.app.test.BeforeAdvice)",argNames="inString")
      public void abc(String inString) {};

      @Around(value = "abc(inString)",argNames="inString")
      public Object ourAroundAdvice(ProceedingJoinPoint pjp, String inString) throws Throwable {

          System.out.println("in around");
          return null;
      }
  }

我的自定义注解

@Documented
@Target({ ElementType.METHOD, ElementType.FIELD })
@Retention(RetentionPolicy.RUNTIME)
public @interface EncryptDemo {

}

我的实体

@Entity
@Table(name="customer")
@JsonIgnoreProperties(ignoreUnknown = true)
public class Customer {

    @Id
    @GeneratedValue
    private Long id;

    private String somethingPublic;

    private String somethingPrivate;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getSomethingPublic() {
        return somethingPublic;
    }

    public void setSomethingPublic(String somethingPublic) {
        this.somethingPublic = somethingPublic;
    }

    public String getSomethingPrivate() {
        return somethingPrivate;
    }

    @EncryptDemo
    public void setSomethingPrivate(String somethingPrivate) {
        this.somethingPrivate = somethingPrivate;
    }
}

我加入这个依赖于POM。

I have added this dependency to pom.

春季开机起动的AOP

spring-boot-starter-aop

aspectjrt

aspectjrt

aspectjweaver

aspectjweaver

我找到了一个解决办法,但我不理解他们所要表达的意思。

I found one solution but I am not understanding what they are trying to say.

<一个href=\"http://stackoverflow.com/questions/6516390/unsupportedpointcutprimitiveexception-on-simple-aop-example\">UnsupportedPointcutPrimitiveException简单的AOP的例子

请指引我走向这一点。任何帮助将AP preciate。

Please guide me towards this. Any help will be appreciate.

感谢。

推荐答案

Spring使用(默认),基于代理的AOP,因此具有连接点前pression只有有限的支持。在呼叫加入不支持仅执行连接点是点。受支持的连接点前pressions是documenten <一个href=\"http://docs.spring.io/spring/docs/current/spring-framework-reference/html/aop.html#aop-pointcuts-designators\"相对=nofollow>这里。

Spring uses (by default) proxy based AOP and as such has only limited support for joinpoint expression. The call join point that isn't supported only the execution join point is. The supported join point expressions are documenten here.

下一步,你正试图AOP适用于非Spring管理的bean这也不会与基于代理的解决方案工作。

Next to that you are trying to apply AOP to a non Spring managed bean this will also not work with a proxy based solution.

有关这两种情况下,你需要为使用的负荷或编译时编织,使其工作。

For both situations you need to use either load or compile time weaving to make it work.

这篇关于切入点前pression“ABC(inString)”包含不支持的切入点原始的“来电”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆