先來看一個spring基本配置檔案的檔案頭
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"
xsi:schemalocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
起到提示作用的是http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
myeclipse會從網上下載下傳該xsd,将該檔案内容緩存
在編寫spring.xml出現提示有如下方法
方法一
打開網絡,讓eclipse自行上網下載下傳
方法二
手動添加schema檔案
① 找到xmlcatalog
windows—>preferences—>myeclipse—>files and editors—>xml—>xmlcatalog
②找到xds檔案
點選add在出現的視窗中的key type中選擇uri,在location中選擇"file system",找到spring解壓目錄的dis/resource目錄中選擇spring-beans-2.5.xsd
③配置相關資訊
将key type改為schema location。key改為http://www.springframework.org/schema/beans/spring-beans-2.5.xsd