spring cloud、gradle、父子项目、微服务框架搭建---spring secuity oauth2、mysql 授权(九)

news2024/9/20 22:22:12

文章目录

    • 一、
    • 二、授权服务
      • 2.1 初始化表结构
      • 2.2 引入依赖
      • 2.3 自定义 用户详情类 UserDetailsService
      • 2.4 授权配置 AuthorizationServerConfiguration
      • 2.5 Web安全配置 WebSecurityConfiguration
      • 2.6 默认生成接口
    • 三、资源服务
      • 3.1 引入依赖
      • 3.2 资源服务 ResourceServerConfig
    • 四、授权测试
      • 4.1 授权码模式
        • (1) 获取code
        • (2)获取授权
      • 4.2 账号密码模式
      • 4.3 请求资源服务,忽略鉴权接口
      • 4.4 请求资源服务,需要鉴权接口
      • 4.5 刷新access_token

一、

新建两个服务
1.授权服务 端口号:11007
2.资源服务 端口号:11004

资源服务可以是订单服务、用户服务、商品服务等等

当然这两个服务也可以合并到一起, 依次顺序AuthorizationServerConfiguration、ResourceServerConfig、WebSecurityConfiguration;

WebSecurityConfiguration 会覆盖ResourceServerConfig的部分配置
例如 authorizeRequests().antMatchers().


二、授权服务

2.1 初始化表结构

sql: https://github.com/spring-attic/spring-security-oauth/blob/main/spring-security-oauth2/src/test/resources/schema.sql

在mysql执行报错时,注意字段为LONGVARBINARY类型,对应mysql的blob类型

表明说明
oauth_client_details客户端账号密码、授权、回调地址等重要信息; 手动插入数据
oauth_access_token存储access_token。 授权成功后自动写入数据,过期后不会删除,但再次获取授权会覆盖
oauth_refresh_token存储refresh_token。授权成功后自动写入数据,过期后不会删除,但再次获取授权会覆盖
oauth_code存储授权码。authorization_code类型的授权code
oauth_approvals存储授权成功的客户端信息。
oauth_client_token存储从服务端获取的token数据。 JdbcClientTokenServices 已经被标记为@Deprecated ,估计已经弃用
clientDetails自定义oauth_client_details表的详情表

oauth_client_token、ClientDetails 暂时无用、可以不用创建

insert一条oauth_client_details数据

INSERT INTO `oauth_client_details` VALUES
 (
 'inside001', 
 NULL, 
 '$2a$10$FCaIYtevbAi5HCXF5PeSVO7zFQgyP7XbPF0zXip7FEL1UrBoE2PyK', 
 'read', 
 'client_credentials,authorization_code,password,refresh_token',
 'http://www.baidu.com', 
 NULL, NULL, NULL, NULL, NULL
 );

2.2 引入依赖

implementation(‘org.springframework.cloud:spring-cloud-starter-oauth2:3.0.0-RC1’)

2.3 自定义 用户详情类 UserDetailsService

package com.xxxx.oauth.service.impl;

import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;

@Service
public class CustomerUserDetailsServiceImpl implements UserDetailsService {

    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        String password = new BCryptPasswordEncoder().encode("1");
        return new User(username, password, AuthorityUtils.createAuthorityList("test"));
    }
}

必须继承org.springframework.security.core.userdetails.UserDetailsService
对于loadUserByUsername的实现, 真实业务可能需要验证username,验证roles等等, 现在直接返回不验证

2.4 授权配置 AuthorizationServerConfiguration

package com.xxxx.oauth.oauth2;

import com.xxxx.oauth.service.impl.CustomerUserDetailsServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer;
import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer;
import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer;
import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerSecurityConfigurer;
import org.springframework.security.oauth2.provider.ClientDetailsService;
import org.springframework.security.oauth2.provider.approval.ApprovalStore;
import org.springframework.security.oauth2.provider.approval.JdbcApprovalStore;
import org.springframework.security.oauth2.provider.client.JdbcClientDetailsService;
import org.springframework.security.oauth2.provider.code.AuthorizationCodeServices;
import org.springframework.security.oauth2.provider.code.JdbcAuthorizationCodeServices;
import org.springframework.security.oauth2.provider.token.DefaultTokenServices;
import org.springframework.security.oauth2.provider.token.TokenStore;
import org.springframework.security.oauth2.provider.token.store.JdbcTokenStore;

import javax.sql.DataSource;
import java.util.concurrent.TimeUnit;


/**
 * 授权服务配置
 *
 * @author Administrator
 */
@Configuration
@EnableAuthorizationServer
public class AuthorizationServerConfiguration extends AuthorizationServerConfigurerAdapter {

    @Autowired
    @Qualifier("authenticationManagerBean")
    private AuthenticationManager authenticationManager;

    @Autowired
    private DataSource dataSource;

    /**
     * 存储令牌,采用数据库
     * @return
     */
    @Bean
    public TokenStore JdbcTokenStore() {
        return new JdbcTokenStore(dataSource);
    }

    /**
     * 授权码,采用数据库
     * @return
     */
    @Bean
    public AuthorizationCodeServices authorizationCodeServices() {
        return new JdbcAuthorizationCodeServices(dataSource);
    }

    /**
     * 授权信息,采用数据库
     * @return
     */
    @Bean
    public ApprovalStore jdbcApprovalStore(){
        return new JdbcApprovalStore(dataSource);
    }

    /**
     * 客户端client服务,采用数据库,且设置加密方式
     * @return
     */
    @Bean
    public ClientDetailsService jdbcClientDetailsService(){
        JdbcClientDetailsService jdbcClientDetailsService = new JdbcClientDetailsService(dataSource);
        jdbcClientDetailsService.setPasswordEncoder(passwordEncoder());
        return jdbcClientDetailsService;
    }

    @Bean
    public PasswordEncoder passwordEncoder() {
        return new BCryptPasswordEncoder();
    }

    /**
     * 自定义 实现用户类
     */
    @Autowired
    private CustomerUserDetailsServiceImpl customerUserDetailsServiceImpl;

    /**
     * 配置端点
     * @param endpoints
     * @throws Exception
     */
    @Override
    public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
        /******令牌服务配置*********************************************************************/
        DefaultTokenServices tokenServices = new DefaultTokenServices();
        // 存储令牌
        tokenServices.setTokenStore(JdbcTokenStore());
        // 是否允许刷新令牌
        tokenServices.setSupportRefreshToken(true);
        // 是否重复使用刷新令牌(直到过期)
        tokenServices.setReuseRefreshToken(true);
        // 客户端client服务
        tokenServices.setClientDetailsService(jdbcClientDetailsService());
        // 用来控制令牌存储增强策略
        tokenServices.setTokenEnhancer(endpoints.getTokenEnhancer());
        // AccessToken有效时间,优先取数据库中的配置,如果未配置,此处才会生效
        tokenServices.setAccessTokenValiditySeconds((int) TimeUnit.DAYS.toSeconds(7));
        // RefreshToken有效时间,优先取数据库中的配置,如果未配置,此处才会生效
        tokenServices.setRefreshTokenValiditySeconds((int) TimeUnit.DAYS.toSeconds(30));


        /******端点配置*********************************************************************/
        //认证管理器
        endpoints.authenticationManager(authenticationManager);
        //用户数据
        endpoints.userDetailsService(customerUserDetailsServiceImpl);
        //令牌存储
        endpoints.tokenStore(JdbcTokenStore());
        //令牌端点的请求方式, 默认是POST
        endpoints.allowedTokenEndpointRequestMethods(HttpMethod.GET,HttpMethod.POST);
        //令牌服务
        endpoints.tokenServices(tokenServices);
        //authorization_code类型的授权,code写入DB,  不配置此项则默认内存
        endpoints.authorizationCodeServices(authorizationCodeServices());

        endpoints.approvalStore(jdbcApprovalStore());
    }

    /**
     * 配置客户端client
     * @param clients
     * @throws Exception
     */
    @Override
    public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
        //client服务
        clients.withClientDetails(jdbcClientDetailsService());
    }

    /**
     * 安全约束
     * @param security
     * @throws Exception
     */
    @Override
    public void configure(AuthorizationServerSecurityConfigurer security) throws Exception {
        security
                //允许客户端使用表单方式发送请求token的认证
                //如果未设置,则需要再http的Authorization中设置授权
                .allowFormAuthenticationForClients()
                // 接口/oauth/token_key的权限    默认拒绝所有 denyAll()  已通过身份验证 isAuthenticated()   permitAll() 公开的
                .tokenKeyAccess("isAuthenticated()")
                // 接口/oauth/check_token的权限   默认拒绝所有 denyAll()  已通过身份验证 isAuthenticated()  permitAll() 公开的
                .checkTokenAccess("isAuthenticated()");
    }
}

2.5 Web安全配置 WebSecurityConfiguration

package com.xxxx.oauth.oauth2;

import com.xxxx.oauth.service.impl.CustomerUserDetailsServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

/**
* @author Administrator
/*/
@Configuration
@EnableWebSecurity
public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {

  /**
   * 自定义 实现用户类
   */
  @Autowired
  public CustomerUserDetailsServiceImpl customerUserDetailsServiceImpl;

  /**
   * 重新实例化 AuthenticationManager Bean
   */
    @Override
    @Bean()
    public AuthenticationManager authenticationManagerBean() throws Exception {
      return super.authenticationManagerBean();
    }

  /**
   * 授权管理配置
   *
   * @param authManager
   * @throws Exception
   */
    @Override
    protected void configure(AuthenticationManagerBuilder authManager) throws Exception {
      authManager.userDetailsService(customerUserDetailsServiceImpl);
    }

  /**
   * 安全约束配置
   *
   * @param webSecurity
   * @throws Exception
   */
   @Override
    public void configure(WebSecurity webSecurity) throws Exception {
      //解决静态资源被拦截的问题
      //web.ignoring().antMatchers("/favicon.ico", "/asserts/**");
    }

    @Override
    protected void configure(HttpSecurity httpSecurity) throws Exception {
      httpSecurity
              .userDetailsService(customerUserDetailsServiceImpl).formLogin().permitAll()
              .and().authorizeRequests()
                    // 自定义的一些接口,可匿名访问
                    .antMatchers("/test/**", "/test1/**").permitAll()
                    // 静态文件,可匿名访问
                    .antMatchers( "/**/*.css", "/**/*.js").permitAll()
                    //排除上面可匿名访问外,其他全部需要鉴权认证
                    .anyRequest().authenticated()
              // 关闭跨域保护;
              .and().csrf().disable();
    }
}

2.6 默认生成接口

/oauth/authorize:授权端点 ,固定授权入口路径 ,也是授权服务器的用户允许授权的页面
/oauth/token :获取令牌端点
/oauth/confirm_access:用户确认授权提交端点
/oauth/error:授权服务错误信息端点
/oauth/check_token:用于资源服务访问的令牌解析端点
/oauth/token_key:提供公有密钥的端点,如果使用 JWT 令牌的话


三、资源服务

3.1 引入依赖

implementation(‘org.springframework.cloud:spring-cloud-starter-oauth2:3.0.0-RC1’)

3.2 资源服务 ResourceServerConfig

package com.xxxx.order.oauth2;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
import org.springframework.security.oauth2.provider.token.RemoteTokenServices;
import org.springframework.security.oauth2.provider.token.ResourceServerTokenServices;

/**
 * @author Administrator
 */
@Configuration
@EnableResourceServer
public class ResourceServerConfig extends ResourceServerConfigurerAdapter {

    @Override
    public void configure(HttpSecurity http) throws Exception {
        http.formLogin().permitAll()
            .and().authorizeRequests()
            // 自定义的一些接口,可匿名访问
            .antMatchers("/hello/sayHello", "/test/**").permitAll()
            //排除上面可匿名访问外,其他全部需要鉴权认证
            .anyRequest().authenticated()
            // 关闭跨域保护;
            .and().csrf().disable();
    }

    /**
     * 资源服务令牌解析服务 配置远程ResourceServerTokenServices后,可不用设置yml远程security.oauth2配置
     *
     * @return
     */
    @Bean
    public ResourceServerTokenServices tokenService() {
        //使用远程服务请求授权服务器校验token,必须指定校验token 的url、client_id,client_secret
        RemoteTokenServices service=new RemoteTokenServices();
        service.setCheckTokenEndpointUrl("http://localhost:11007/oauth/check_token");
        service.setClientId("inside001");
        service.setClientSecret("1");

        return service;
    }
}

四、授权测试

4.1 授权码模式

(1) 获取code

浏览器请求授权码:http://localhost:11007/oauth/authorize?client_id=inside001&response_type=code&redirect_uri=http://www.baidu.com

client_id和redirect_uri的参数必须auth_client_details表中插入的数据

登录授权完成后浏览器会重定向到:https://www.baidu.com/?code=R0RtrN 此时R0RtrN为授权码

(2)获取授权

post请求地址: http://localhost:11007/oauth/token
body中参数 x-wwww-form-urlencoded

grant_type:authorization_code
code:R0RtrN    上一步获取的code
client_id:inside001
client_secret:1
redirect_uri:http://www.baidu.com

响应结果:

  {
    "access_token": "b9d0bf39-47d2-43bd-ade4-abf4fdf8cd73",
    "token_type": "bearer",
    "refresh_token": "e0898a7f-f2d5-4d91-81b4-9e259ede88a9",
    "expires_in": 3599,
    "scope": "read"
  }

在这里插入图片描述

4.2 账号密码模式

post请求地址: http://localhost:11007/oauth/token

请求body:
body中参数 x-wwww-form-urlencoded

grant_type:password
client_id:inside001
client_secret:1
username:inside001
password:1

username就是自定义用户详情类CustomerUserDetailsServiceImpl.loadUserByUsername验证处理,目前未验证,可随便输入

响应结果:

{
  "access_token": "b9d0bf39-47d2-43bd-ade4-abf4fdf8cd73",
  "token_type": "bearer",
  "refresh_token": "e0898a7f-f2d5-4d91-81b4-9e259ede88a9",
  "expires_in": 3599,
  "scope": "read"
}

在这里插入图片描述

4.3 请求资源服务,忽略鉴权接口

因为在资源服务的ResourceServerConfig配置中,configure(HttpSecurity http)方法下,.antMatchers(“/hello/sayHello”, “/test/**”).permitAll() 配置了

接口直接请求, 例如:http://localhost:11004/hello/sayHello

4.4 请求资源服务,需要鉴权接口

请求:csshttp://localhost:11004/hello/passwordEncoder?pwd=1

在请求header中添加access_token:Authorization:Bearer 33453e78-cc4b-4ca8-8d5d-bbfd719a1f8b

在这里插入图片描述

4.5 刷新access_token

正常情况下,access_token有效时间小于refresh_token有效时间,access_token失效后可利用refresh_token重新获取access_token, 当refresh_token失效后就需要重新获取授权。

post请求地址: http://localhost:11007/oauth/token

body中参数 x-wwww-form-urlencoded

grant_type:refresh_token
refresh_token:0f941d67-da95-479c-bef4-435b5c823402
client_id:inside001
client_secret:1

在这里插入图片描述





本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/948414.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

2023年DAMA-CDGA/CDGP数据治理认证线上班到这里

DAMA认证为数据管理专业人士提供职业目标晋升规划,彰显了职业发展里程碑及发展阶梯定义,帮助数据管理从业人士获得企业数字化转型战略下的必备职业能力,促进开展工作实践应用及实际问题解决,形成企业所需的新数字经济下的核心职业…

探讨三维模型OBJ格式轻量化在数据存储的重要性

探讨三维模型OBJ格式轻量化在数据存储的重要性 三维模型的OBJ格式轻量化在数据存储方面具有重要性。以下是对三维模型OBJ格式轻量化在数据存储的重要性进行浅析: 1、节省存储空间:原始的三维模型文件往往非常庞大,占据大量的存储空间。通过进…

亚马逊产品流量来源?产品流量如何增加?

"亚马逊产品流量"通常指的是在亚马逊平台上的商品页面上产生的访问量或点击量。这是衡量产品在亚马逊上的曝光和受关注程度的重要指标之一。产品流量的多少可以影响销售和排名等方面。 亚马逊产品流量的来源可以有多种,包括: 1、有机流量&…

基于python的豆瓣电影数据分析可视化系统(包含文档+源码)

本系统采用Python技术和Django 搭建系统框架,后台使用MySQL数据库进行信息管理,设计开发基于python的豆瓣电影数据分析可视化系统。通过调研和分析,系统拥有管理员和用户两个角色,主要具备个人中心、电影管理、用户管理、系统管理…

基于Spring Boot的高校学生党校系统设计与实现(Java+spring boot+MySQL)

获取源码或者论文请私信博主 演示视频: 基于Spring Boot的高校学生党校系统设计与实现(Javaspring bootMySQL) 使用技术: 前端:html css javascript jQuery ajax thymeleaf 微信小程序 后端:Java spring…

DC电源模块在仪器设备中使用的突出表现

BOSHIDA DC电源模块在仪器设备中使用的突出表现 DC电源模块是一种广泛应用于各种电子设备中的电源设备,它的最显著特点就是可以将电源直接转换为直流电,而且可以根据需要进行稳定地输出,这使得它在很多领域都有着广泛的应用。 在仪器设备中…

Android Native Code开发学习(二)JNI互相传参返回调用

Android Native Code开发学习(二) 本教程为native code学习笔记,希望能够帮到有需要的人 我的电脑系统为ubuntu 22.04,当然windows也是可以的,区别不大 一、native code介绍 native code就是在android项目中混合C或…

网银U盾插拔烦,试试USB Serve解决方案

公司网银U盾太多,每次办理网银业务都要不停插拔,效率低,管理难,怎么办? 交给USB Sever管理就行了! 第一步 根据你需要的USB端口, 选择适合你的朝天椒USB Sever, 把网银U盾都插上去…

“Ahuja”补偿

自1968年Fairchild引入uA741以来,Miller补偿已被广泛用于集成运算放大器和相关电路的频率补偿。R.Read和J.Wieser早在1982年就提出了另一种补偿形式[1][2]。 尽管如此,它还是花了一段时间才被业界和学术界所接受,随着它在米勒补偿方面的一些…

Python数学建模1-模拟人类一生中会认识多少人的模型统计与分析

大家好,我是微学AI,今天给大家带来Python数学建模1-模拟人类一生中会认识多少人的模型统计与分析。你有没有统计过从出生到现在你接触过多少人了,你认识了多少人了,可能你只是认识,但是现在基本不联系了,可…

ZooKeeper的典型应用场景及实现

文章目录 1、典型应用场景及实现1.1、 数据发布/订阅1.1.1、配置管理案列 1.2、负载均衡1.3、命名服务1.4、分布式协调/通知1.4.1、一种通用的分布式系统机器间通信方式 1.5、集群管理1.6、Master选举1.7、分布式锁1.7.1、排他锁1.7.2、共享锁 1.8、分布式队列 2、ZooKeeper在大…

【LeetCode每日一题】——274.H指数

文章目录 一【题目类别】二【题目难度】三【题目编号】四【题目描述】五【题目示例】六【题目提示】七【解题思路】八【时间频度】九【代码实现】十【提交结果】 一【题目类别】 排序 二【题目难度】 中等 三【题目编号】 274.H指数 四【题目描述】 给你一个整数数组 ci…

ReID网络:MGN网络(3) - 数据组织

1. 概述 首先ReID不仅仅可以搞行人,当然也可以处理其他目标,这个是大家需要领会的一点。 用于ReID的行人数据集,一般是有多段同一目标在不同时间的采样序列组成。例如同一个行人,间隔5秒采集一张图像,连续采集30张。…

Swift 中的动态成员查找

文章目录 前言基础介绍基础示例1. 定义一个动态成员访问类:2. 访问嵌套动态成员: 使用 KeyPath 的编译时安全性KeyPath 用法示例KeyPath 进阶使用示例1. 动态访问属性:2. 结合可选属性和 KeyPath:3. 动态 KeyPath 和字典&#xff…

使用calc()调整元素高度或宽度

<style>.parent { display: flex;padding: 0px 5px;width: 600px;height: 200px;background: #ccc;}.children { margin: 10px 10px;/* 减去padding和margin */height: calc(100% - 20px);width: calc(100% - 30px);background: skyblue;}</style><div class&qu…

嵌入式Linux开发实操(十四):SPI接口开发

# 前言 SPI(Serial Peripheral Interface)同UART、I2C、CAN等一样,是MCU/SOC的重要接口,没错,它是个通讯接口,一个串行通讯接口,我们想到了四线接口(CS、CLK、MOSI、MISO) 可以通过CS(ChipSelect)或者SS (Slave Select)线来选择和哪个SPI设备通信,选择就是把这条线…

无涯教程-Android - Linear Layout函数

Android LinearLayout是一个视图组&#xff0c;该视图组将垂直或水平的所有子级对齐。 Linear Layout - 属性 以下是LinearLayout特有的重要属性- Sr.NoAttribute & 描述1 android:id 这是唯一标识布局的ID。 2 android:baselineAligned 此值必须是布尔值&#xff0c;为…

Java中ArrayList.remove(index)漏删的问题

问题描述 ArrayList中数据删除漏删 测试代码如下 public static void main(String[] args) {List<Integer> list new ArrayList<>();for(int i0;i<10;i){list.add(i1);}System.out.println("删除前&#xff1a;list.szie() "list.size());for(i…

什么是跨域问题 ?Spring MVC 如何解决跨域问题 ?

1. 什么是跨域问题 &#xff1f; 跨域问题指的是不同站点之间&#xff0c;使用 ajax 无法相互调用的问题。 跨域问题的 3 种情况&#xff1a; 1. 协议不同&#xff0c;例如 http 和 https&#xff1b; http://127.0.0.1:8080https://127.0.0.1:8080 2. 域名不同&#xff1…

在springboot项目中显示Services面板的方法

文章目录 前言方法一&#xff1a;Alt8快捷键方法二&#xff1a;使用Component标签总结 前言 在一个springboot项目中&#xff0c;通过开启Services面板&#xff0c;可以快速的启动、配置、管理多个子项目。 方法一&#xff1a;Alt8快捷键 1、在idea界面输入Alt8&#xff0c;在…