Spring/Spring: Annotation 정리
[Spring:Annotation] context:component-scan 요소가 자동으로 인식하는 annotation 정리
데브마우스
2024. 1. 16. 19:00
servlet-context.xml이나 root-context.xml에서 <context:component-scan> 요소가 자동으로 인식하는 annotation입니다.
|
context:component-scan 요소가 자동으로 인식하는 애너테이션
|
|
| Annotation | 설명 |
| @Component |
특별히 역할 구분 없이 Component라고 알려 주는 역할을 합니다.
|
| @Repository |
DB 작업 관련 Component를 의미합니다.
|
| @Service |
서비스 관련 Component를 의미합니다.
|
| @Controller |
MVC 컨트롤러 Component를 의미합니다.
|
| @Required |
필수 프로퍼티임을 명시하는 데 사용합니다.
|
| @Autowired |
클래스의 전역 변수에 객체를 채울 때 사용합니다.
|
| @Inject |
특정 프레임워크에 종속되지 않는 자바의 표준화된 방법으로 의존성 주입을 정의합니다.
|