AOP가 필요한 상황

문제

AOP 적용

Untitled

@Component
@Aspect
public class TimeTraceAop { @Around("execution(* hello.hellospring..*(..))")
 public Object execute(ProceedingJoinPoint joinPoint) throws Throwable {
	 long start = System.currentTimeMillis();
	 System.out.println("START: " + joinPoint.toString());
	 try {
	 return joinPoint.proceed();
	 } finally {
	 long finish = System.currentTimeMillis();
	 long timeMs = finish - start;
	 System.out.println("END: " + joinPoint.toString()+ " " + timeMs +
	"ms");
	 }
	 }
}

해결