일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- http
- Proxy
- spring
- Exception
- 스프링 핵심 원리
- QueryDSL
- 스프링 핵심 기능
- java
- Servlet
- kotlin
- 백준
- 스프링
- 그리디
- JDBC
- Android
- Spring Boot
- AOP
- 알고리즘
- transaction
- Greedy
- 인프런
- springdatajpa
- SpringBoot
- pointcut
- 자바
- Thymeleaf
- jpa
- JPQL
- 김영한
- db
- Today
- Total
목록@annotation (4)
개발자되기 프로젝트
@Retry 애노테이션이 있으면 예외가 발생했을 때 다시 시도해서 문제를 복구한다. 1. @Retry Retry방식을 사용할 때 항상 재시도 횟수가 정해져 있어야 함. @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface Retry { int value() default 3; //Retry는 항상 재시도 횟수가 있어야함.. } 2. RetryAspect @Slf4j @Aspect public class RetryAspect { /* @Around("@annotation(hello.aop.exam.annotation.Retry)") public Object doRetry(ProceedingJoinPoint join..
@Trace 가 메서드에 붙어 있으면 호출 정보가 출력되도록 하자. 1. @Trace @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface Trace { } 2. TraceAspect @Slf4j @Aspect public class TraceAspect { @Before("@annotation(hello.aop.exam.annotation.Trace)") public void doTrace(JoinPoint joinPoint){ Object[] args = joinPoint.getArgs(); log.info("[trace] {}, args={}", joinPoint.getSignature(), args); }..
다음포인트컷들은 표현식을 사용해서 어드바이스에 매개변수를 전달할 수 있다. this, target, args,@target, @within, @annotation, @args @Before("allMember() && args(arg,..)") public void logArgs3(String arg) { log.info("[logArgs3] arg={}", arg); } 포인트컷의 이름과 매개변수의 이름을 맞추어야 한다. 여기서는 arg 로 맞추었다. 추가로 타입이 메서드에 지정한 타입으로 제한된다. (당연...) 여기서는 메서드의 타입이 String 으로 되어 있기 때문에 다음과 같이 정의되는 것으로 이해하면 된다. args(arg,..) --> args(String,..) 1. Test @Slf4j..
1. @annotation 메서드가, 주어진 애노테이션을 가지고 있는 조인 포인트를 매칭 @annotation(hello.aop.member.annotation.MethodAop) -->@MethodAop를 가지고 있는 메서드에 적용 다음과 같이 메서드(조인 포인트)에 애노테이션이 있으면 매칭한다. public class MemberServiceImpl { @MethodAop("test value") public String hello(String param) { return "ok"; } } 2. Test @ClassAop @Component public class MemberServiceImpl implements MemberService{ @Override @MethodAop("test value"..