多平台统一管理软件接口,如何实现多平台统一管理软件接口
264
2023-05-12
详解Spring Security 简单配置
开发环境
maven
idea
jdk 1.8
tomcat 8
配置spring mvc + spring security
pom.xml
spring mvc 使用的是4.3.8版本,spring security 使用的是4.2.2版本。
spring-mvc-servlet.xml
xmlns:context="http://springframework.org/schema/context" xmlns:xsi="http://w3.org/2001/XMLSchema-instance" xsi:schemahttp://Location=" http://springframework.org/schema/beans http://springframework.org/schema/beans/spring-beans-4.0.xsd http://springframework.org/schema/context http://springframework.org/schema/context/spring-context-4.0.xsd">
xmlns:context="http://springframework.org/schema/context"
xmlns:xsi="http://w3.org/2001/XMLSchema-instance"
xsi:schemahttp://Location="
http://springframework.org/schema/beans
http://springframework.org/schema/beans/spring-beans-4.0.xsd
http://springframework.org/schema/context
http://springframework.org/schema/context/spring-context-4.0.xsd">
spring-security.xml
xmlns="http://springframework.org/schema/security" xmlns:beans="http://springframework.org/schema/beans" xmlns:p="http://www.springframework.org/schema/p" xmlns:xsi="http://w3.org/2001/XMLSchema-instance" xmlns:context="http://springframework.org/schema/context" xsi:schemaLocation="http://springframework.org/schema/beans http://springframework.org/schema/beans/spring-beans.xsd http://springframework.org/schema/context http://springframework.org/schema/context/spring-context.xsd http://springframework.org/schema/security http://springframework.org/schema/security/spring-security.xsd">
xmlns="http://springframework.org/schema/security"
xmlns:beans="http://springframework.org/schema/beans"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:xsi="http://w3.org/2001/XMLSchema-instance"
xmlns:context="http://springframework.org/schema/context"
xsi:schemaLocation="http://springframework.org/schema/beans
http://springframework.org/schema/beans/spring-beans.xsd
http://springframework.org/schema/context
http://springframework.org/schema/context/spring-context.xsd
http://springframework.org/schema/security
http://springframework.org/schema/security/spring-security.xsd">
web.xml
xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> classpath:spring-mvc-servlet.xml, classpath:spring-security.xml
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
classpath:spring-mvc-servlet.xml,
classpath:spring-security.xml
测试
spring会拦截所有请求,如果没有登录,则系统会跳转到spring security默认的登录页面。
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~