Skip to content
Discussion options

You must be logged in to vote

저희 스프링 핵심 원리에서 사용했던 부분이 있습니다.
강의 정보는 #6. 컴포넌트 스캔 - 필터 부분에 있습니다.

package hello.core.scan.filter;

import java.lang.annotation.*;

@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface MyIncludeComponent {
}
package hello.core.scan.filter;

import java.lang.annotation.*;

@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface MyExcludeComponent {
}

Meta Annotation (@target, @retention)

  • 다른 annotation에서도 사용되는 annotation의 경우를 말하며 custom-annotation을 생성할때 주로 사용된다.

@target은 Java Compiler가 annotation이 어디에 적용될지 결정하기 위해 사용한다.

  • ElementType.TYPE은 해당 Annotation은 타입 선언 시 사용한다는 의미이다.

@retention은 Annotation이 실제로 적용되고 유지되는 범위…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by seyxxn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 participants