@Controller
public class HomeController {
@RequestMapping(value = "/", method = RequestMethod.GET)
public String home(Locale locale, Model model) throws Exception {
System.out.println("메소드 안이여");
return "home";
}
}
@Component
@Aspect
public class PerfAspect {
// logPerf 메소드 즉 어드바이스를 어떻게 정의할 것인가
// @Around poinitcut 설정
@SuppressWarnings("unused")
@Around("execution(* kr.co..*.HomeController.*(..))")
public Object logPerf(ProceedingJoinPoint pjp) throws Throwable{
Long begin = System.currentTimeMillis();
System.out.println("메소드 호출 전이여");
Object raVal = pjp.proceed();
System.out.println("메소드 호출 후여");
return raVal;
}
}