標籤:statistic 紅色 clear 需要 b2c lin content 分享圖片 encoding
Spring的設定檔ApplicationContext.xml配置標頭檔解析原創 2016年12月16日 14:22:43
spring中的applicationContext.xml配置標頭檔解析<?xmlversion="1.0"encoding="UTF-8"?><beansxmlns="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的值。在這裡特別說明的原因是有時我們會從網上複製標頭檔不知道其中的原理這樣就會出現版本不對應的錯誤
注意!!!首先要保證 http://www.springframework.org/schema/beans/spring-beans.xsd 的約束檔案Schema location要配置得有,不然其他的Schema location即使配置了也不會出來!!! 其次:key:的xsd檔案最好不要寫版本號碼
到此aop的標頭檔就配置完了,其他標頭檔標籤配置與此類似。
Spring的設定檔ApplicationContext.xml配置標頭檔解析