<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
">
<!-- 扫描包路径:会扫描cn.xxx.xxx包及其子包下所有的类,如果类上面有实例化Bean的注解(例如:@Controller,@Service,@Component,@Repository),容器就会创建该类的实例,并交给容器管理。否则不创建-->
<context:component-scan base-package="cn.xxx.xxx" />
<!--如果有多个包可以再写一条context-->