wiki:springboot:spring_boot_annotation:spring_boot_annotation
문서의 이전 판입니다!
spring_boot_annotation
Annotation
@ComponentScan
@Component와 @Service, @Repository, @Controller, @Configuration이 붙은 클래스 Bean들을 찾아서 Context에 bean등록을 해주는 Annotation
@Component로 다 쓰지 왜 굳이 @Repository, @Service, @Controller등을 사용하냐면 예를들어 @Repository는 DAO의 메소드에서 발생할 수 있는 unchecked exception들을 스프링의 DataAccessException으로 처리할 수 있기 때문이다. 또한 가독성에서도 해당 애노테이션을 갖는 클래스가 무엇을 하는지 단 번에 알 수 있다.
/volume1/web/dokuwiki/data/attic/wiki/springboot/spring_boot_annotation/spring_boot_annotation.1597983079.txt.gz · 마지막으로 수정됨: 2022/03/10 19:52 (바깥 편집)