built a simple springboot application with some aspects checking architecture and so on.
i try to catch every call to System.out.println() to give warning about usage so that is what i've found so far:
System.out.println() uses PrintStream so that i've tried this:
@Aspect
@Component
public class CleanCodeAspect {
@Before("call(void java.io.PrintStream.println(String))")
public void beforePrintlnCall() {
System.out.println("About to make call to print Hello World");
}
}
But with no success. The log says
The pointcutexpression call(void java.io.PrintStream.println(String)) contains unsupported pointcut primitive 'call'
A similar Aspect is working, but with execution instead of call:
@Aspect
@Component
public class BooleanServiceMonitor {
@Before("execution(* de.fhb..*Service.*(java.lang.Boolean))")
public void logServiceAccess() {
System.out.println("You used a method with only one boolean parameter. "
+ "Refactor it into 2 methods with True, False at the end.");
}
}