<?xml version="1.0" encoding="UTF-8"?> <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"> <!--对登录和失败页面放行--> <security:http pattern="/login.jsp" security="none"></security:http> <security:http pattern="/error.jsp" security="none"></security:http> <security:http pattern="/favicon.ico" security="none"></security:http> <security:http pattern="/css/**" security="none"></security:http> <security:http pattern="/img/**" security="none"></security:http> <security:http pattern="/plugins/**" security="none"></security:http> <security:http auto-config="true" use-expressions="false"> <security:intercept-url pattern="/**" access="ROLE_USER"/> <!--页面的具体跳转--> <security:form-login login-page="/login.jsp" login-processing-url="/login" default-target-url="/index.jsp" ></security:form-login> <security:csrf disabled="true"/> <!--退出--> <security:logout invalidate-session="true" logout-url="/logout" logout-success-url="/login.jsp"/> </security:http> <!--配置默认可以登录的账户密码--> <security:authentication-manager> <security:authentication-provider> <security:user-service> <security:user name="ding" password="{noop}ding" authorities="ROLE_USER" /> </security:user-service> </security:authentication-provider> </security:authentication-manager> </beans>