I use aspectj and spring boot. I am trying to log a message when a method(boolean value) is called. aspects are working in general, but my expression for catching must be wrong
it is working with (but is of cause catching every method):
@Before("execution(* de.fhb..*(..))")
also working (catching with only one parameter)
@Before("execution(* de.fhb..*(*))")
now the problem:
@Before("execution(* de.fhb..*(boolean))")
or
@Before("execution(* de.fhb..*(java.lang.Boolean))")
does not work. Any help? The mistake must be between execution(* de.fhb..*((my error i think))
here my files (getter && setter are generated with lombok):
pojo:
package de.fhb.showcase;
@Getter @Setter
public class Show {
private String name;
private boolean live;
public void makeShowLive(boolean value) {
live = value;
}
}
aspect:
package de.fhb.aop;
import javax.inject.Named;
import lombok.extern.java.Log;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
@Aspect
@Named
@Log
public class CleanCodeAspect {
@Before("execution(* de.fhb..*(..))")
public void checkStyleBooleanParameter() {
log.warning("You used a method with only one boolean parameter. "
+ "Refactor it into 2 methods with True, False at the end.");
}
}