<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="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-4.2.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-4.1.xsd">
和
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:security="http://www.springframework.org/schema/security"
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.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security.xsd">
在前者的區別,安全配置爲
<http auto-config="true">
<intercept-url pattern="/login" access="permitAll()" />
</http>
而在後者將被配置爲
<security:http auto-config="true">
<security:intercept-url pattern="/login" access="permitAll()" />
</security:http>
我不確定這兩種模式格式之間的功能差異。也有人可以建議哪些是可喜的或哪些情況下哪些更可取?
請參見[XML名稱空間](http://www.w3schools.com/xml/xml_namespaces.asp)。在你的第一個片段中,* security *命名空間很可能被用作基本命名空間。在後面的* beans *名稱空間被用作基名稱空間 –
謝謝,這是一個有用的指針。 – Jake