hz/cctp-production/cctp-test-bug/README.md

46 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# gz-gateway 网关模块
基于`Spring Cloud Gateway`组件实现的网关
![原理图](doc/img/spring-cloud-gateway.png)
导入依赖
```xml
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-gateway</artifactId>
</dependency>
```
## HTTP转发
根据微服务注册中心(cctp-eureka)里注册的微服务自动转发`application.yaml`配置片段:
```yaml
spring:
cloud:
gateway:
discovery:
locator:
enabled: true
lower-case-service-id: true
```
## HTTP SESSION管理
引用Spring提供的sesion管理组件通过redis共享session信息
```xml
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis-reactive</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
</dependency>
</dependencies>
```