I am new to spring-aop concepts.
I am getting this error during compilation.
org.aspectj.weaver.tools.UnsupportedPointcutPrimitiveException: Pointcut expression 'abc(inString)' contains unsupported pointcut primitive 'call'
My aspect is,
@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;
}
}
My custom annotation
@Documented
@Target({ ElementType.METHOD, ElementType.FIELD })
@Retention(RetentionPolicy.RUNTIME)
public @interface EncryptDemo {
}
My entity
@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;
}
}
I have added this dependency to pom.
spring-boot-starter-aop
aspectjrt
aspectjweaver
I found one solution but I am not understanding what they are trying to say.
UnsupportedPointcutPrimitiveException on simple AOP example
Please guide me towards this. Any help will be appreciate.
Thanks.
calljoin point that isn't supported by spring only theexecutionjoin point is. See docs.spring.io/spring/docs/current/spring-framework-reference/… - M. Deinum