整合会员模块.md 1.6 KB

1、引入spzx-user模块、spzx-api-user模块

  1. 将课后资料中spzx-user模块复制到spzx-modules

  2. spzx-modules模块pom.xml聚合用户子模块

    <modules>
         <module>spzx-user</module>
    </modules>
    
  3. 将将课后资料中spzx-api-user模块复制到spzx-api

  4. spzx-api下模块pom.xml聚合用户远程调用子模块

    <modules>
           <module>spzx-api-user</module>
    </modules>
    

2、引入nacos配置文件nacos_config_export_spzx-user.zip

  1. 在Nacos配置,导入资料用户模块配置文件:spzx-user-dev.yml
  2. 修改配置文件内Redis、MySQL数据库连接信息
  3. 回到spzx-user模块bootstrap.yml修改Nacos连接信息

3、配置网关

在spzx-gateway-dev.yml配置文件中添加会员服务的网关信息

    - id: spzx-user
      uri: lb://spzx-user
      predicates:
        - Path=/user/**
      filters:
        - StripPrefix=1
# 不校验白名单
ignore:
  whites:
    ...
    - /auth/h5/**

4、引入依赖

spzx-modules模块

<dependency>
    <groupId>com.spzx</groupId>
    <artifactId>spzx-api-user</artifactId>
    <version>3.6.3</version>
</dependency>

spzx-auth模块

<dependency>
    <groupId>com.spzx</groupId>
    <artifactId>spzx-api-user</artifactId>
    <version>3.6.3</version>
</dependency>

5、修改spzx-common-core

ServiceNameConstants中添加spzx-user

/**
 * 会员用户服务的serviceid
 */
public static final String USER_SERVICE = "spzx-user";

6、spzx-auth

将资料中的代码复制到spzx-auth中