Spring.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">
   <!-- &lt;!&ndash;把对象的创建交给spring来管理&ndash;&gt;
    <bean id="accountService" class="com.itheima.service.impl.AccountServiceImpl"></bean>
    <bean id="accountDao" class="com.itheima.dao.impl.AccountDaoImpl"></bean>-->
   <!--告知spring在创建容器时要扫描的包,配置所需要的标签不是在beans的约束中,而是一个名称
      context名称空间和约束
   -->
   <context:component-scan base-package="com.itheima"></context:component-scan>
</beans>
 posted on 2019-12-25 10:19  爱舔奶盖的小野狼  阅读(117)  评论(0)    收藏  举报