mirror of
https://github.com/orbien-org/orbien.git
synced 2026-09-22 00:01:31 +00:00
84 lines
2.3 KiB
Plaintext
84 lines
2.3 KiB
Plaintext
---
|
||
sidebar_position: 1
|
||
sidebar_label: SpringBoot集成
|
||
---
|
||
import Tabs from '@theme/Tabs';
|
||
import TabItem from '@theme/TabItem';
|
||
|
||
# Spring Boot 集成
|
||
|
||
**Orbien** 提供可内嵌到 Spring Boot 的 Java 客户端,当前能力:
|
||
|
||
- 隧道协议:仅 **TCP**、**HTTP**
|
||
- 传输层:仅 **TCP**
|
||
- **不支持 TCP 多路复用**:`orbien.tcp-mux` 必须为 `false`,服务端也需 `[transport].tcpMux = false`(服务端默认开启多路复用,与 Java 客户端联调时需显式关闭)
|
||
|
||
<Tabs>
|
||
<TabItem value="Maven" label="Maven" default>
|
||
```xml
|
||
<dependency>
|
||
<groupId>io.github.lxien</groupId>
|
||
<artifactId>orbien-spring-boot-starter</artifactId>
|
||
<version>3.4.0-dev</version>
|
||
</dependency>
|
||
```
|
||
</TabItem>
|
||
<TabItem value="Gradle" label="Gradle">
|
||
```groovy
|
||
implementation("io.github.lxien:orbien-spring-boot-starter:3.4.0-dev")
|
||
```
|
||
</TabItem>
|
||
</Tabs>
|
||
|
||
## 最小配置
|
||
|
||
`local-port` / `name` 可省略:未填时分别使用 Spring Boot Web 端口与 `spring.application.name`(或 `orbien-{protocol}`)。
|
||
|
||
```yaml
|
||
# application.yml
|
||
orbien:
|
||
enabled: true
|
||
server-addr: 127.0.0.1
|
||
# token: YOUR_TOKEN # 可选
|
||
tunnel:
|
||
protocol: http
|
||
domains:
|
||
- web.domain.com
|
||
```
|
||
|
||
服务端需关闭多路复用,例如:
|
||
|
||
```toml
|
||
# orbien-server.toml
|
||
listen = "0.0.0.0:9527"
|
||
httpGwPort = 80
|
||
|
||
[transport]
|
||
tcpMux = false # 关闭 TCP 多路复用
|
||
```
|
||
|
||
## 完整参考
|
||
|
||
```yaml
|
||
# application.yml
|
||
orbien:
|
||
enabled: true
|
||
server-addr: 127.0.0.1
|
||
server-port: 9527
|
||
token: YOUR_TOKEN
|
||
tcp-mux: false # 必须为 false,且与服务端一致
|
||
pool-count: 1 # 登录时预申请的数据连接池大小
|
||
heartbeat-interval-secs: 30
|
||
user: spring-boot-demo # 可选,展示在 Dashboard
|
||
# session-id: "" # 可选;为空则从 session-id-file 恢复,或自动生成
|
||
# session-id-file: "" # 可选;为空则使用用户目录下的默认路径
|
||
tunnel:
|
||
name: web-demo # 可选
|
||
protocol: http # tcp | http
|
||
local-ip: 127.0.0.1
|
||
# local-port: 8080 # 可选;未填则使用 Spring Boot 监听端口
|
||
# remote-port: 9000 # 仅 protocol=tcp 时需要
|
||
domains: # protocol=http 时必填
|
||
- web.domain.com
|
||
```
|