Spring的配置文件ApplicationContext.xml配置头文件解析


spring中的applicationContext.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:tx = "http://www.springframework.org/schema/tx"
      xmlns:aop = "http://www.springframework.org/schema/aop"
      xmlns:context = "http://www.springframework.org/schema/context"
      xsi:schemaLocation = "
     http://www.springframework.org/schema/beans
     http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
     http://www.springframework.org/schema/context
     http://www.springframework.org/schema/context/spring-context-4.1.xsd
      http://www.springframework.org/schema/tx
     http://www.springframework.org/schema/tx/spring-tx-4.1.xsd
     http://www.springframework.org/schema/aop
     http://www.springframework.org/schema/aop/spring-aop-4.1.xsd
     " >
</beans>
首先要做的是导入相关 jar 包,这里一 aop 为例所以只说导入了 aop 相关的 jar
这四个 jar 包是必不可少的。
jar包下载地址: http://pan.baidu.com/s/1nvTPNRV

配置头文件所引用的文件包(版本号要匹配上)

步骤
(1) 、下载 spring-framework-4.1.6

(2)eclipse中点击window-preferances,在弹出框中输入xml catalog,看到如下界面


点击add

从文件选择其中找到你所下载的 spring-framework-4.16 打开文件夹,然后打开 schema 文件夹
该目录下就是你所要引入的相关标签的文件夹
下面以 aop 标签为例,其他标签都是同样的操作步骤。
1 )、打开 aop 文件夹。然后选中 spring-aop-4.1.xsd ,点击打卡如图
在这里需要特别注意的是 location: F:\JavaIntegration\spring-framework-4.1.6.RELEASE-dist\spring-framework-4.1.6.RELEASE\schema\aop\spring-aop-4.1.xsd 中的绿色背景的文字是与图中绿色框中的一样的,也就是版本一定要对应上,而红色框中的值就是上图中 key 的值。在这里特别说明的原因是有时我们会从网上复制头文件不知道其中的原理这样就会出现版本不对应的错误

到此 aop 的头文件就配置完了,其他头文件标签配置与此类似。


发布了42 篇原创文章 · 获赞 32 · 访问量 8万+

猜你喜欢

转载自blog.csdn.net/m0_37027631/article/details/53692634
今日推荐