Pooja Mahapatra
Pooja Mahapatra

Reputation: 125

AspectJ with Spring boot

I am working on a spring boot microservice. I am new to AspectJ. I am trying to create an aspect for logging. This is my aspect component.

@Aspect 
@Component
public class UserAcessAspect {

private static final Logger logger = LoggerFactory.getLogger(UserAcessAspect.class);

@Before("execution(com.profectus.insights.service.impl.InsightsElasticityServiceImpl.*(..))")
public void beforeAdvice(Joinpoint joinPoint, InsightRequest request) {
    logger.info("ASPECTJ------------------->>>>>>>>>>>>");
}

}

I am getting the following error

Caused by: java.lang.IllegalArgumentException: Pointcut is not well-formed:     
expecting 'name pattern' at character position 78
execution(com.profectus.insights.service.impl.InsightsElasticityServiceImpl.*(..))

Upvotes: 0

Views: 1213

Answers (1)

kriegaex
kriegaex

Reputation: 67457

Maybe you should read

in order to learn the syntax first.

What is wrong with your pointcut is that the method signature has no return type. You want to write something like

execution(* com.profectus.insights.service.impl.InsightsElasticityServiceImpl.*(..))

Upvotes: 1

Related Questions