本节操作完成了对spring父容器中service层扫描加载的配置。
1、在resources中创建applicationContext-service.xml
具体操作如下图所示:
2、修改applicationContext-service.xml
<?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 http://www.springframework.org/schema/context/spring-context.xsd">
<!--扫描controller层-->
<context:component-scan base-package="net.wanho.service"></context:component-scan>
</beans>
至此,我们完成了对spring父容器中service扫描加载的配置。