Spring Security(七):2.4 Getting Spring Security
You can get hold of Spring Security in several ways. You can download a packaged distribution from the main Spring Security page, download individual jars from the Maven Central repository (or a Spring Maven repository for snapshot and milestone releases) or, alternatively, you can build the project from source yourself.
2.4.1 Usage with Maven (使用Maven)
A minimal Spring Security Maven set of dependencies typically looks like the following:
<dependencies>
<!-- ... other dependency elements ... -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>4.2.10.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>4.2.10.RELEASE</version>
</dependency>
</dependencies>
If you are using additional features like LDAP, OpenID, etc. you will need to also include the appropriate Section 2.4.3, “Project Modules”.
Maven Repositories
All GA releases (i.e. versions ending in .RELEASE) are deployed to Maven Central, so no additional Maven repositories need to be declared in your pom.
<repositories>
<!-- ... possibly other repository elements ... -->
<repository>
<id>spring-snapshot</id>
<name>Spring Snapshot Repository</name>
<url>http://repo.spring.io/snapshot</url>
</repository>
</repositories>
If you are using a milestone or release candidate version, you will need to ensure you have the Spring Milestone repository defined as shown below:
<repositories>
<!-- ... possibly other repository elements ... -->
<repository>
<id>spring-milestone</id>
<name>Spring Milestone Repository</name>
<url>http://repo.spring.io/milestone</url>
</repository>
</repositories>
Spring Framework Bom (良好的spring框架)
Spring Security builds against Spring Framework 4.3.21.RELEASE, but should work with 4.0.x. The problem that many users will have is that Spring Security’s transitive dependencies resolve Spring Framework 4.3.21.RELEASE which can cause strange classpath problems.
spring-framework-bomwithin your <dependencyManagement> section of your pom.xml as shown below:<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>4.3.21.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
This will ensure that all the transitive dependencies of Spring Security use the Spring 4.3.21.RELEASE modules.
This approach uses Maven’s "bill of materials" (BOM) concept and is only available in Maven 2.0.9+. For additional details about how dependencies are resolved refer to Maven’s Introduction to the Dependency Mechanism documentation. 这种方法使用Maven的“物料清单”(BOM)概念,仅适用于Maven 2.0.9+。有关如何解析依赖关系的其他详细信息,请参阅Maven的依赖关系机制简介文档。
2.4.2 Gradle
A minimal Spring Security Gradle set of dependencies typically looks like the following:
dependencies {
compile 'org.springframework.security:spring-security-web:4.2.10.RELEASE'
compile 'org.springframework.security:spring-security-config:4.2.10.RELEASE'
}
Gradle Repositories
All GA releases (i.e. versions ending in .RELEASE) are deployed to Maven Central, so using the mavenCentral() repository is sufficient for GA releases.
repositories {
mavenCentral()
}
If you are using a SNAPSHOT version, you will need to ensure you have the Spring Snapshot repository defined as shown below:
repositories {
maven { url 'https://repo.spring.io/snapshot' }
}
If you are using a milestone or release candidate version, you will need to ensure you have the Spring Milestone repository defined as shown below:
repositories {
maven { url 'https://repo.spring.io/milestone' }
}
Using Spring 4.0.x and Gradle
By default Gradle will use the newest version when resolving transitive versions. This means that often times no additional work is necessary when running Spring Security 4.2.10.RELEASE with Spring Framework 4.3.21.RELEASE. However, at times there can be issues that come up so it is best to mitigate this using Gradle’s ResolutionStrategy as shown below:
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'org.springframework') {
details.useVersion '4.3.21.RELEASE'
}
}
}
This will ensure that all the transitive dependencies of Spring Security use the Spring 4.3.21.RELEASE modules.
Spring Security(七):2.4 Getting Spring Security的更多相关文章
- Spring Cloud实战 | 第九篇:Spring Cloud整合Spring Security OAuth2认证服务器统一认证自定义异常处理
本文完整代码下载点击 一. 前言 相信了解过我或者看过我之前的系列文章应该多少知道点我写这些文章包括创建 有来商城youlai-mall 这个项目的目的,想给那些真的想提升自己或者迷茫的人(包括自己- ...
- Spring Security 3.2.x与Spring 4.0.x的Maven依赖管理
原文链接: Spring Security with Maven原文日期: 2013年04月24日翻译日期: 2014年06月29日翻译人员: 铁锚 1. 概述 本文通过实例为您介绍怎样使用 Mave ...
- Spring MVC 项目搭建 -3- 快速 添加 spring security
Spring MVC 项目搭建 -3- 快速 添加 spring security 1.添加 spring-sample-security.xml <!-- 简单的安全检验实现 --> & ...
- Spring Security 入门(1-6-1)Spring Security - 配置文件解析和访问请求处理
1.在pom.xml中添加maven坐标 <dependency> <groupId>org.springframework.security</groupId> ...
- Spring Security 入门(1-7)Spring Security - Session管理
参考链接:https://xueliang.org/article/detail/20170302232815082 session 管理 Spring Security 通过 http 元素下的子元 ...
- Spring Security 入门(1-3-5)Spring Security - remember me!
Remember-Me 功能 概述 Remember-Me 是指网站能够在 Session 之间记住登录用户的身份,具体来说就是我成功认证一次之后在一定的时间内我可以不用再输入用户名和密码进行登录了, ...
- Spring Security 入门(1-6-2)Spring Security - 内置的filter顺序、自定义filter、http元素和对应的filterChain
Spring Security 的底层是通过一系列的 Filter 来管理的,每个 Filter 都有其自身的功能,而且各个 Filter 在功能上还有关联关系,所以它们的顺序也是非常重要的. 1.S ...
- Spring Security 入门(1-3-2)Spring Security - http元素 - intercept-url配置
http元素下可以配置登录页面,也可以配置 url 拦截. 1.直接配置拦截url和对应的访问权限 <security:http use-expressions="false" ...
- Spring Security 入门(1-4-2)Spring Security - 认证过程之AuthenticationProvider的扩展补充说明
1.用户信息从数据库获取 通常我们的用户信息都不会向第一节示例中那样简单的写在配置文件中,而是从其它存储位置获取,比如数据库.根据之前的介绍我们知道用户信息是通过 UserDetailsService ...
- Spring Security 入门(1-3-1)Spring Security - http元素 - 默认登录和登录定制
登录表单配置 - http 元素下的 form-login 元素是用来定义表单登录信息的.当我们什么属性都不指定的时候 Spring Security 会为我们生成一个默认的登录页面. 如果不想使用默 ...
随机推荐
- K8S 部署 ingress-nginx (一) 原理及搭建
Kubernetes 暴露服务的有三种方式,分别为 LoadBlancer Service.NodePort Service.Ingress.官网对 Ingress 的定义为管理对外服务到集群内服务之 ...
- nginx 转将http跳转到https
#websoceket 使用map map $http_upgrade $connection_upgrade { default upgrade; '' close; } upstream abc. ...
- win10电脑怎么录制视频 电脑录制视频软件
win10电脑怎么录制视频?相信不少网友正在面临这个疑惑.现如今是网络信息科技时代,快速传播信息的途径和方式有很多种.其中,通过录制电脑视频,可以制作视频教程.游戏解说,还可以录制在线视频存储影视资源 ...
- Testlink1.9.17使用方法(第十三章 使用中遇到的问题)
第十三章 使用中遇到的问题 一. 登录Testlink后,新建一个项目后,会出现如下提示: 解决办法:打开Testlink安装文件夹下的config.inc.php文件, 原来:$tlCfg-> ...
- day15(PYTHON)推导式{生成器,字典,列表,集合}
#[每一个元素或者是和元素相关的操作 for 元素 in 可迭代数据类型] #遍历之后挨个处理 #[满足条件的元素相关的操作 for 元素 in 可迭代数据类型 if 元素相关的条件] #筛选功能 # ...
- LeetCode题解之Binary Tree Right Side View
1.题目描述 2.问题分析 使用层序遍历 3.代码 vector<int> v; vector<int> rightSideView(TreeNode* root) { if ...
- 同一个菜品商家中心和erp价格显示不一致解决方案FAQ
1.适用场景: 2.问题原因:子账号在商家中心改了价格 3.解决办法: (1).子账号登录商家后台修改 再同步(2).ERP上商品管理 修改价格
- springmvc复习笔记----springmvc最简单的第一个例子:RequestMapping试水
结构 用到的包 web.xml <url-pattern>/</url-pattern>中可以换成其他的后缀*.do ,*. sb …… <?xml version=& ...
- 转:修改IIS虚拟目录名称bat脚本
@echo off echo ------------------------------------------------------------------------------ echo - ...
- python3使用selenium + Chrome基础操作代码
selenium是Python的第三方库,使用前需要安装.但是如果你使用的是anaconda,就可以省略这个步骤,为啥?自带,任性. 安装命令: pip install selenium (一)使用s ...