<?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"<!--找到带有context的命名空间的beans,这样才会有语句提示--> 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"> <!--打开Spring的Annotation支持--> <context:annotation-config/> <!--设定Spring去哪些包中找Annotation--> <context:component-scan base-package="org.example"/> </beans>