dify-spring-boot-starter
  • 介绍
  • 快速开始
  • 安装
  • 配置
  • 客户端构建器
  • 服务状态监控
  • 功能

    • Chat API
    • Workflow API
    • Dataset API
    • Server API
  • 事件

    • 介绍
    • 聊天事件
  • 使用配置
  • 自定义配置
  • v2.x
  • v1.x
  • v0.x
  • 更新日志
  • 简体中文
  • English
GitHub
  • 介绍
  • 快速开始
  • 安装
  • 配置
  • 客户端构建器
  • 服务状态监控
  • 功能

    • Chat API
    • Workflow API
    • Dataset API
    • Server API
  • 事件

    • 介绍
    • 聊天事件
  • 使用配置
  • 自定义配置
  • v2.x
  • v1.x
  • v0.x
  • 更新日志
  • 简体中文
  • English
GitHub
  • 指南

    • 介绍
    • 快速开始
    • 安装
    • 配置
    • 客户端构建器
    • 服务状态监控
  • 功能

    • Chat API
    • Workflow API
    • Dataset API
    • Server API
  • 事件

    • 介绍
    • 聊天事件

配置

dify-spring-boot-starter 的配置非常简单,只需要一些基础配置即可开始使用!

请确保您已经安装了 dify-spring-boot-starter,如果您尚未安装,请查看 安装。

Spring Boot 自动配置

对于 Spring Boot 项目,框架会自动配置所有必要的组件,您只需要在配置文件中提供连接参数即可。

基础配置

dify:
  url: http://192.168.1.10 # Dify 服务地址
  server:
    email: admin@admin.com # Dify 服务邮箱(调用 Server API 时需要)
    password: admin123456 # Dify 服务密码(调用 Server API 时需要)
    password-encryption: true # 密码加密开关,默认 true
                               # Dify 1.11.2+ 需要开启(或使用 Base64 密文)
                               # Dify 1.11.2 以下版本设置为 false
  dataset:
    api-key: dataset-aaabbbcccdddeeefffggghhh # 知识库 API Key(调用 Dataset API 时需要)

客户端配置

dify:
  client-config:
    skip-null: true # 是否跳过 null 字段,默认 true
    logging: true # 是否打印请求日志,默认 true
    connect-timeout: 30 # 连接超时时间(秒),默认 30
    read-timeout: 30 # 读取超时时间(秒),默认 30
    write-timeout: 30 # 写入超时时间(秒),默认 30

状态监控配置

dify:
  status:
    health-indicator-enabled: false # 是否启用健康指示器,默认 false
    health-indicator-init-by-server: true # 是否通过 Server 初始化,默认 true
    api-key: your-api-key # 通用 API Key(可选)
    dataset-api-key: dataset-key # Dataset API Key(可选)
    chat-api-key: # Chat API Key 列表(可选)
      - chat-key-1
      - chat-key-2
    workflow-api-key: # Workflow API Key 列表(可选)
      - workflow-key-1

完整配置示例

dify:
  url: http://192.168.1.10
  server:
    email: admin@admin.com
    password: admin123456
    password-encryption: true
  dataset:
    api-key: dataset-aaabbbcccdddeeefffggghhh
  client-config:
    skip-null: true
    logging: true
    connect-timeout: 30
    read-timeout: 30
    write-timeout: 30
  status:
    health-indicator-enabled: true
    health-indicator-init-by-server: true

详细配置参数说明请查看 配置参数。

纯 Java 项目配置

对于纯 Java 项目(不使用 Spring Boot),您需要手动构建客户端。请查看 构建器模式 了解详细信息。

在 GitHub 上编辑此页
上次更新: 2026/1/17 11:58
Prev
安装
Next
客户端构建器