cloudnaut
cloudnaut

Reputation: 982

Pointcut with a class name pattern

test.core and I want an aspect around every class in that or a sub-package with the name pattern Service.

sth like this: "execution(public de.test.core..Service.*(..)" but it doesn t seem to work.

Is aspectJ even able to match to a class pattern?

Upvotes: 6

Views: 3974

Answers (1)

GUISSOUMA Issam
GUISSOUMA Issam

Reputation: 2582

Match all methods defined in beans whose name ends with ‘Service’.

bean(*Service)

Match by Service pattern

@Pointcut("within(*..*Service)")
public void inServiceClass() {}

Upvotes: 5

Related Questions