spring - Is <context: annotation-config> necessary for annotation @Resource , @PostConstruct and @PreDestroy? -
i new in spring , want know if write @resource or @postconstruct or @predestroy annotation on method of class necessary add "context: annotation-config" tag in xml file register method.
my confusion @resource or @postconstruct or @predestroy jsr-250 annotation not specific spring-framework why "context: annotation-config" tag added in config file(spring.xml).
i know applicable @required , @autowired annotation.
can explain please ?
the thing that, no matter annotation is, doesn't anything, kind of mark tell other thing means. , when add context: annotation-config
in xml file, when start tomcat or other load environment of spring, when found context: annotation-config
, register beans spring has implemented scan class find annotation @resource or @postconstruct or @predestroy, , thing do, such instantiate bean, bind value , on.
Comments
Post a Comment