Home Java의 Annotation 알아보기 - 애너테이션
Post
Cancel

Java의 Annotation 알아보기 - 애너테이션

출처: Package org.springframework.core.annotation / Annotation Interface AliasFor


애너테이션(어노테이션)이란?

    코드에서 @으로 작성되는 요소.
    클래스 또는 인터페이스를 컴파일하거나 실행할 때,
어떻게 처리해야 할 것인지를 알려주는
설정 정보이다.
(출처: 『이것이 자바다』)

Annotations, a form of metadata, provide data about a program that is not part of the program itself. Annotations have no direct effect on the operation of the code they annotate.

애너테이션은 프로그램 자기 자신을
포함하지 않는 데이터를 제공하며
메타데이터 형식으로 된 것이다.
해당 애너테이션은 그 코드에 대해선
직접적인 영향을 주진 않는다.
(출처: 오라클 - 자바 튜토리얼의 애너테이션 부분 中</b>)

Annotations have a number of uses, among them:

- Information for the compiler — Annotations can be used by the compiler to detect errors or suppress warnings.
- Compile-time and deployment-time processing — Software tools can process annotation information to generate code, XML files, and so forth.
- Runtime processing — Some annotations are available to be examined at runtime.

애너테이션이 사용되는
여러 용도들은 아래 세 가지 중 하나.

  • 컴파일러에 대한 정보
    : 컴파일러가 에러를 탐지하거나
    경고를 숨기도록 하기 위해 사용됨.
  • 컴파일 타임과 deployment 타임 프로세싱
    : 코드나 XML 파일과 같은 것들을 생성할 때
    SW 도구가 애너테이션을 이용함.
  • 런타임 프로세싱
    : 런타임에 감지되어 쓰이는 것들도 있음.

Contents