我已經構建了Spring MVC應用程序,並將其應用到了一個高級的級別。將安全性集成到Spring MVC應用程序(applicationContext Issue)
現在我的任務是整合Spring Security。我現在正在關注彈簧安全this tutorial。現在的問題是,在我的MVC應用程序中已經有一個applicationContext.xml,它是MVC應用程序的父應用程序上下文定義。
正如在教程中提到的安全性,我應該爲了安全性而添加一個新的應用程序上下文xml文件嗎?其中包含代碼:
<?xml version="1.0" encoding="UTF-8"?>
<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-2.5.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.4.xsd">
<global-method-security secured-annotations="disabled">
</global-method-security>
<http auto-config="true">
<intercept-url pattern="/**" access="ROLE_USER" />
</http>
<authentication-provider>
<user-service id="userDetailsService">
<user name="username" password="password" authorities="ROLE_USER, ROLE_ADMIN" />
<user name="test" password="test" authorities="ROLE_USER" />
</user-service>
</authentication-provider>
</beans:beans>
在此先感謝。
P.S. /編輯:或者我應該將它複製到我的MVC應用程序的原始/現有applicationContext.xml文件?
非常感謝。我還有一個問題,那就是我的MVC應用程序的web.xml中有一個taglib。任何想法是什麼? – AbdulAziz 2012-02-20 10:41:12
1)你在說什麼taglib? 2)正如Ralph所指出的,本教程已過時,您應該使用Spring 3.0。 – 2012-02-20 10:46:57