일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- 인프런
- jpa
- pointcut
- db
- Thymeleaf
- 그리디
- JDBC
- 김영한
- 스프링 핵심 기능
- SpringBoot
- QueryDSL
- spring
- transaction
- 백준
- JPQL
- Servlet
- java
- springdatajpa
- Exception
- 알고리즘
- 스프링 핵심 원리
- http
- Greedy
- Proxy
- kotlin
- 스프링
- 자바
- AOP
- Android
- Spring Boot
- Today
- Total
목록execution (6)
개발자되기 프로젝트
1. bean 스프링 전용 포인트컷 지시자, 빈의 이름으로 지정한다 스프링 빈의 이름으로 AOP 적용 여부를 지정한다. bean(orderService) || bean(*Repository) * 과 같은 패턴을 사용할 수 있다. 2. Test @Slf4j @Service public class OrderService { private final OrderRepository orderRepository; public OrderService(OrderRepository orderRepository) { this.orderRepository = orderRepository; } public void orderItem(String itemId) { log.info("[orderService] 실행"); orde..
args : 인자가 주어진 타입의 인스턴스인 조인 포인트로 매칭 기본 문법은 execution 의 args 부분과 같다. 1. execution과 args의 차이점 execution 은 파라미터 타입이 정확하게 매칭되어야 한다. execution 은 클래스에 선언된 정보를 기반으로 판단한다. args 는 부모 타입을 허용한다. args 는 실제 넘어온 파라미터 객체 인스턴스를 보고 판단한다. 2. Argstest @Slf4j public class ArgsTest { Method helloMethod; @BeforeEach public void init() throws NoSuchMethodException { helloMethod = MemberServiceImpl.class.getMethod("hel..
within 지시자는 특정 타입 내의 조인 포인트에 대한 매칭을 제한한다. 쉽게 이야기해서 해당 타입이 매칭되면 그 안의 메서드(조인 포인트)들이 자동으로 매칭된다. 문법은 단순한데 execution 에서 타입 부분만 사용한다고 보면 된다. 1. Test @Slf4j public class WithinTest { AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut(); Method helloMethod; @BeforeEach public void init() throws NoSuchMethodException { helloMethod = MemberServiceImpl.class.getMethod("hello", String.class)..
1. 타입 매칭 - 부모 타입 허용 @Test void typeExactMatch(){ pointcut.setExpression("execution(* hello.aop.member.MemberServiceImpl.*(..))"); assertThat(pointcut.matches(helloMethod, MemberServiceImpl.class)).isTrue(); } @Test void typeMatchSuperType(){ pointcut.setExpression("execution(* hello.aop.member.MemberService.*(..))"); assertThat(pointcut.matches(helloMethod, MemberServiceImpl.class)).isTrue(); } ..
1. execution 문법 execution(modifiers-pattern? ret-type-pattern declaring-type-pattern?namepattern(param-pattern) throws-pattern?) execution(접근제어자? 반환타입 선언타입?메서드이름(파라미터) 예외?) 메소드 실행 조인 포인트를 매칭한다. ?는 생략할 수 있다. * 같은 패턴을 지정할 수 있다. 2. 가장 정확한 포인트컷 먼저 MemberServiceImpl.hello(String) 메서드와 가장 정확하게 모든 내용이 매칭되는 표현식이다. @Slf4j public class ExecutionTest { AspectJExpressionPointcut pointcut = new AspectJExpres..
AOP : Aspect Oriented Programming (관점 지향 프로그램) 핵심적인 관심사항(Core Concern)과 공통 관심 사항(Cross cutting concern)으로 분리하고 각각을 모듈화 하는 것. 예를 들어 각 메서드마다 실행 전후 log를 남기고 싶다?? 모든 method다마다 일일히 추가하는건 귀찮기도하고.. 숫자가 많아지면 수정 시 놓칠 가능성도 있음. 따라서 부가기능으로 AOP를 적용하여 log남길 수 있음. 1. @Aspect : 구현하고자 하는 횡단 관심사의 모듈. 한개 이상의 포인트컷과 어드바이스의 조합으로 만들어진다. 2. Advice : 실질적인 부가기능을 담은 구현체? aspect가 무엇을? 언제? 할지 정의함. 3. execution : A..