Difference between and

前端 未结 15 2770
再見小時候
再見小時候 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:32

    : Scanning and activating annotations for already registered beans in spring config xml.

    : Bean registration +


    @Autowired and @Required are targets property level so bean should register in spring IOC before use these annotations. To enable these annotations either have to register respective beans or include . i.e. works with registered beans only.

    @Required enables RequiredAnnotationBeanPostProcessor processing tool
    @Autowired enables AutowiredAnnotationBeanPostProcessor processing tool

    Note: Annotation itself nothing to do, we need a Processing Tool, which is a class underneath, responsible for the core process.


    @Repository, @Service and @Controller are @Component, and they targets class level.

    it scans the package and find and register the beans, and it includes the work done by .

    Migrating XML to Annotations

提交回复
热议问题