步骤:
1 <?xml version="1.0" encoding="UTF-8"?> 2 <beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 3 xmlns="http://www.springframework.org/schema/beans" 4 xmlns:context="http://www.springframework.org/schema/context" 5 xsi:schemaLocation="http://www.springframework.org/schema/beans 6 http://www.springframework.org/schema/beans/spring-beans-4.3.xsd 7 http://www.springframework.org/schema/context 8 http://www.springframework.org/schema/context/spring-context-4.3.xsd "> 9 10 <!-- base-package即为所要添加注解的类中的包名 --> 11 <context:component-scan base-package="po"></context:component-scan> 12 </beans>
原文:https://www.cnblogs.com/Sx-Wang/p/14054042.html