API 参考

使用指南-快速开始

使用指南中的快速开始内容。

快速开始

1. 添加自动配置依赖

<!-- 统一自动配置模块 -->
<dependency>
    <groupId>io.nebula</groupId>
    <artifactId>nebula-autoconfigure</artifactId>
    <version>2.0.1-SNAPSHOT</version>
</dependency>

<!-- 按需添加功能模块 -->
<dependency>
    <groupId>io.nebula</groupId>
    <artifactId>nebula-discovery-nacos</artifactId>
</dependency>
<dependency>
    <groupId>io.nebula</groupId>
    <artifactId>nebula-rpc-http</artifactId>
</dependency>
<dependency>
    <groupId>io.nebula</groupId>
    <artifactId>nebula-data-persistence</artifactId>
</dependency>
<!-- 其他模块... -->

2. 配置应用

spring:
  application:
    name: my-nebula-app

nebula:
  # 服务发现配置
  discovery:
    nacos:
      enabled: true
      server-addr: localhost:8848
      namespace: dev

  # RPC 配置
  rpc:
    http:
      enabled: true
    discovery:
      enabled: true

  # 数据访问配置
  data:
    persistence:
      enabled: true
    cache:
      enabled: true

3. 启动应用

所有配置的功能模块将自动初始化并可用,无需手动配置