0
我正在努力應對Spring Security,我想我到目前爲止的工作,但有人可以向我解釋這裏的一些東西?我特別想知道爲什麼我需要在這個配置文件中使用這個前綴beans:
:爲什麼我在這裏需要一個「bean:」前綴?
<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.1.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-4.0.xsd">
<beans:import resource="applicationContext-jooq.xml"/>
<global-method-security pre-post-annotations="enabled" secured-annotations="enabled" />
<http auto-config="true" >
<intercept-url pattern="/**" access="hasRole('ROLE_ADMIN')" />
</http>
<authentication-manager >
<authentication-provider>
<user-service>
<user name="admin" password="admin" authorities="ROLE_ADMIN" />
</user-service>
</authentication-provider>
</authentication-manager>
<!-- BEGIN Services -->
<beans:bean id="loginService" class="com.mz.server.web.service.LoginService">
<beans:constructor-arg>
<beans:ref bean="dsl" />
</beans:constructor-arg>
</beans:bean>
<!-- END Services -->
</beans:beans>
另一件事我想了解的是之間
<intercept-url pattern="/" .. />
<intercept-url pattern="/*" .. />
<intercept-url pattern="/**" .. />
嗨!究竟是什麼讓Spring Security成爲我的根標題呢?或者更好:如何聲明一個根頭?通過標題你的意思是一個bean配置文件,對吧? – displayname
因爲它沒有明確的聲明。請參閱xmlns vs xmlns:beans。請參閱:http://www.w3schools.com/xml/xml_namespaces.asp –