2016년 7월 18일 월요일

[스프링프레임워크강좌교육] - 스프링실무교육학원

<context:annotation-config/>와<context:component-scan/>[스프링프레임워크강좌교육] - 스프링실무교육학원

<context:annotation-config/>은 4가지 타입의 BeanPostProcessors를 등록하여 어노테이션이 사용가능 하도록 한다.

CommonAnnotationBeanPostProcessor : @PostConstruct, @PreDestroy, @Resource
AutowiredAnnotationBeanPostProcessor : @Autowired, @Value, @Inject, @Qualifier, etc
RequiredAnnotationBeanPostProcessor : @Required
PersistenceAnnotationBeanPostProcessor :@PersistenceUnit and @PersistenceContext

<context:component-scan/>은 Spring2.5이상에서 사용되었으며 논리적으로 <context:annotation-config/>를 상속받았다고 보면 된다.(추가적으로 빈을 스캐닝해서 등록할 수 있는 기능이 있다

즉 <context:component-scan>=<context:annotation-config>+Bean Registration)

즉 <context:component-scan/>를 사용했다면 <context:annotation-config/>은 생략 가능하다.물론 component-scan을 사용하면서 annotation-config를 사용하지 않을 수도 있다.

<context:component-scan annotation-config="false"/>

댓글 없음:

댓글 쓰기