Spring注释学习 几步走

来源:互联网 发布:嵌入式软件开发团队 编辑:程序博客网 时间:2024/06/06 01:24
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

<!-- 1步  :我们用到的xml命名空间  -->

    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans-2.5.xsd


<!-- 2步  :我们用到的xml的命名格式,自动提示是可以配置的  -->

            http://www.springframework.org/schema/context

            http://www.springframework.org/schema/context/spring-context-2.5.xsd">

<!--3步  :    <context:annotation-config/>spring程序启动时扫描我们的注释的类,给容器  。可以不写  -->

            <!-- <context:annotation-config/> -->


    <!--4步  :给定扫描的范围我们就不用配置<bean>了  -->

            <context:component-scan base-package="com.spring.annotationTest"/>
            
</beans>
0 0
原创粉丝点击