Spring configuration file common annotations

1.  <context:component-scan base-package="com.base.controller" />

It is Spring's component scan settings, and it injects beans through annotations, which is another way to implement bean injection in addition to xml. base-package is the package that needs to be scanned, and the subpackages under this package will also be scanned.

 

@Component is the common form for all Spring-managed components, and @Repository, @Service and @Controller are refinements of @Component.

 

2.  <mvc:annotation-driven />

The explanation in spring-mvc-xsd is:

Configures the annotation-driven Spring MVC Controller programming model

 

Used to configure the annotation-driven Spring MVC controller programming model. 

 

 

 

Guess you like

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