Difference between and

前端 未结 15 2429
再見小時候
再見小時候 2020-11-22 04:44

I\'m learning Spring 3 and I don\'t seem to grasp the functionality behind and .

15条回答
  •  [愿得一人]
    2020-11-22 05:43

    you can find more information in spring context schema file. following is in spring-context-4.3.xsd

    
    
    Activates various annotations to be detected in bean classes: Spring's @Required and
    @Autowired, as well as JSR 250's @PostConstruct, @PreDestroy and @Resource (if available),
    JAX-WS's @WebServiceRef (if available), EJB 3's @EJB (if available), and JPA's
    @PersistenceContext and @PersistenceUnit (if available). Alternatively, you may
    choose to activate the individual BeanPostProcessors for those annotations.
    
    Note: This tag does not activate processing of Spring's @Transactional or EJB 3's
    @TransactionAttribute annotation. Consider the use of the 
    tag for that purpose.
    
    
    
    Scans the classpath for annotated components that will be auto-registered as
    Spring beans. By default, the Spring-provided @Component, @Repository, @Service, @Controller, @RestController, @ControllerAdvice, and @Configuration stereotypes    will be detected.
    
    Note: This tag implies the effects of the 'annotation-config' tag, activating @Required,
    @Autowired, @PostConstruct, @PreDestroy, @Resource, @PersistenceContext and @PersistenceUnit
    annotations in the component classes, which is usually desired for autodetected components
    (without external configuration). Turn off the 'annotation-config' attribute to deactivate
    this default behavior, for example in order to use custom BeanPostProcessor definitions
    for handling those annotations.
    
    Note: You may use placeholders in package paths, but only resolved against system
    properties (analogous to resource paths). A component scan results in new bean definitions
    being registered; Spring's PropertySourcesPlaceholderConfigurer will apply to those bean
    definitions just like to regular bean definitions, but it won't apply to the component
    scan settings themselves.
    

提交回复
热议问题