請幫我諮詢一下。從spring-security.xml文件中禁用Spring Security
我需要通過xml文件中的某些變量禁用/啓用我的應用程序的彈簧安全性。
我的彈簧security.xml文件
<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-3.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.1.xsd">
<http auto-config="true">
<intercept-url pattern="/*" access="ROLE_ADMIN" />
<logout logout-success-url="/mainpage" />
<login login-success-url="/mainpage" />
</http>
<authentication-manager>
<authentication-provider>
<user-service>
<user name="hey" password="there" authorities="ROLE_ADMIN" />
</user-service>
</authentication-provider>
</authentication-manager>
怎麼可以這樣perfomed? 謝謝。
感謝您的回覆!但仍然有問題。當添加security =「none」時,會出現以下異常:org.springframework.beans.factory.parsing.BeanDefinitionParsingException:配置問題:如果使用定義不安全模式,則不能包含子元素。有沒有其他方式來執行? –
me1111
@ me1111:我已更新答案 –
感謝您的幫助和參考!研究 – me1111