spring-security-oauth2 与 spring-cloud-starter-oauth2 [英] spring-security-oauth2 vs spring-cloud-starter-oauth2

查看:122
本文介绍了spring-security-oauth2 与 spring-cloud-starter-oauth2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Spring Boot 构建 oAuth2 应用程序.但是,Github 中有各种使用 spring-security-oauth2spring-cloud-starter-oauth2 的示例项目.
我们是否有可以在应用程序中使用特定 jar 的特定场景?

虽然Spring cloud主要用于分布式系统.Github 上有很多使用 spring-cloud-starter-oauth2 的实现,甚至是非分布式应用程序.谢谢.

I am working on building an oAuth2 application using spring boot. However, there are various sample projects in Github using spring-security-oauth2 and spring-cloud-starter-oauth2.
Do we have specific scenarios where we can use a specific jar among both for an application?

Though Spring cloud is mainly used for distributed systems. There are a lot of implementations on Github using spring-cloud-starter-oauth2 for even non-distributed applications. Thanks.

推荐答案

为了解决复杂的依赖管理,引入了 Spring Boot 启动器.Starter POM 是一组依赖项描述符(将多个常用依赖项组合到一个 POM 中),否则您也可以手动将其单独包含在您的应用程序中.Starters 可用于 Web、测试、数据 jpa、安全性、邮件等.如果它不是 starter,它就是一个模块:一个简单的神器.

To resolve complex dependency management, Spring Boot starters were introduced. Starter POMs are a set of dependency descriptors (combines multiple commonly used dependencies into one POM) which otherwise you could also manually include in your application individually. Starters are available for web, test, data jpa, security, mailing and more. If it is not starter, it is a module: a simple artifact.

如果您想使用 Web,您可以自己(手动)包含 tomcat、mvc 和 jackson - 单个简单应用程序的大量依赖项.相反,您只需引入一个启动器依赖项:

If you want to work with web, you could include tomcat, mvc and jackson all by yourself (manually) - a lot of dependencies for a single simple application. Instead, you just introduce one starter dependency:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>

回答您的问题:

spring-security-oauth2org.springframework.security.oauth 组的工件,它支持 oAuth2(仅)用于 Spring Security(非云),而 spring-cloud-starter-oauth2 是一组多个依赖项,就像上面的 starter web 依赖项一样.这是 Spring Cloud 的 OAuth2 启动器,仅当您使用 Spring Cloud 时.这个 starter 在适用于 Spring Cloud 的 OAuth2 框架下附带了一系列开箱即用的依赖项,例如 SSO、OAuth2 客户端.

spring-security-oauth2 is an artifact of group org.springframework.security.oauth which supports oAuth2 (only) for Spring Security (not cloud), whereas spring-cloud-starter-oauth2 is a set of multiple dependencies like a starter web dependency above. This is OAuth2 starter for Spring Cloud that is only if you are working with Spring cloud. This starter comes with bundle of out-of-the-box dependencies underneath the OAuth2 framework for Spring Cloud like SSO, OAuth2 client.

这篇关于spring-security-oauth2 与 spring-cloud-starter-oauth2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆