You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
AOP가 왜 필요할까?
가정: 모든 메서드에 실행 시간을 측정하고 싶다면
위와 같은 코드 모든 메서드에 무한 반복..
문제
공통 관심 사항위와 같은 문제를 해결할 수 있는 게 바로
AOP다AOP 적용
AOP: Aspect Oriented Programming공통 관심 사항 vs 핵심 관심 사항 분리
공통 관심 사항이라면 비즈니즈 로직 ex) 회원가입은핵심 관심 사항원하는 곳에 공통 관심 사항을 적용할 수 있다.
@Aspect어노테이션 사용@Component어노테이션 사용자바 설정 파일에 따로 등록 (주로 지향)
@Around어노테이션으로 해당 기능을 적용할 영역을 지정해준다.문제 해결
핵심 관심 사항과공통 관심 사항을 분리할 수 있다.공통 관심 사항에 대한 로직을 별도로 분리했기 때문에 변경이 필요하면 해당 로직만 변경해주면 되어 유지 보수에 용이하다동작 원리

Proxy라는 가상의 서비스가 주입되어AOP를 적용할 수 있다.실제 로그를 찍어보면
Proxy가 주입되는지 확인할 수 있다.Beta Was this translation helpful? Give feedback.
All reactions