<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd">
<!--组件扫描-->
<!--
<context:component-scan base-package="com.moon.spring"></context:component-scan>
-->
<!--
use-default-filters="false":表示不使用默认的filter,使用自己配置的filter
context:include-filter:设置扫描哪些内容
-->
<context:component-scan base-package="com.moon.spring" use-default-filters="false">
<!--代表只扫描@Controller注解的类-->
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
<context:component-scan base-package="com.moon.spring" use-default-filters="true">
<!--代表扫描@Controller外的其他注解-->
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
</beans>