Spring support for @Controller given by vs

后端 未结 3 833
你的背包
你的背包 2020-12-13 22:16

I\'ve been researching what additional capabilities we have when using the mvc:annotation-driven tag and I\'m having a difficult time digesting the results, especially in re

3条回答
  •  不知归路
    2020-12-13 23:03

    • Case 1(annotation-driven)

      This is Enabling Spring annotations tag. All the annotations such as @Controller, @Service, @Autowired etc.. can be used. This doesn't creates a bean, but find the the annotations, and spring creates corresponding bean for that class if found annotation(such as @Controller, @Service, @Autowired etc..) .

    • Case 2(component-scan)

      Spring will scan the package (and subpackages) of the classes specified in declaration and creates bean for it.

提交回复
热议问题