2014-05-02 25 views
1

在我的計劃中所使用的咖啡豆標籤的屬性是:爲什麼在applicationContext.xml中需要<beans>屬性?

<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:p="http://www.springframework.org/schema/p" 
    xmlns:aop="http://www.springframework.org/schema/aop" 
    xmlns:tx="http://www.springframework.org/schema/tx" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd 
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd 
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd"> 

爲什麼又是什麼每個屬性的說明?

回答

5

這些是名稱空間聲明。理想情況下,xml中的每個元素必須綁定到特定的模式。如果您想使用AOP,交易等多種Spring功能,則需要這些屬性。

請閱讀here瞭解XML架構和名稱空間

相關問題