AOP는 ??? -> Aspect Oriented Programming
즉 관점지향프로그래밍 ..-> 특정 로직을 관점을 기준으로 각각 모듈화하는 것
핵심 로직이 아닌 .... 공통 관심 사항을 추가할때 하나하나 넣기에는 굉장히 힘들고 유지보수가 힘들다 -> 이때 AOP를 추가해서 원하는 곳에 공통 관심 사항을 적용할 수 있음 !!

이렇게 적용됨
package hello.hellospring.aop;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;
@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");
}
}
}
SpringConfig 스프링빈 넣어주는게 깔꼼
@Bean
puvlic TimeTraceAop() timeTraceAop() {
return new TimeTraceAop();
}
입문 끝 !~!~!~!~!~!~!~!~!~!~!~ 나 자신은 복습공부를 하도록 하세요 ~!~!~!~!~!
객체지향 .......... 가보자고 !~~!