spring mvc scan annotation (ioc,di)

spring mvc scan annotation (ioc,di)

As long as you scan seconds to control, otherwise the transaction will not work , use-default-filters defaults to true, which will scan @component and its sub-annotations under the specified package,

To limit the success, the 1 package path is limited in detail. At this time, you don’t have to worry about use-default-filters, which defaults to true (all inclusive), thinking that even if true is a full scan, there is only this one in my package, which can be excluded with exclude ( further ), include is meaningless (all inclusive)

            2 The package path is not specific and relatively rough, you can use-default-filters=false (not all included) in combination with include, exclude exclusion is further accurate

 

<context:component-scan base-package="com.esteel.**.controller" /> ioc Inversion of Control

 

<!-- Start the annotation-driven Spring MVC function to realize the mapping of foreground data or operation annotations-->

<mvc:annotation-driven /> di Dependency Injection

 

When the service of @AutoWire is used in the controller layer, it will be scanned again (configuration file first, then @Service), and the same is true for the mapper layer

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326519751&siteId=291194637