dify-spring-boot-starter
  • Guide
  • Getting-started
  • Install
  • Configure
  • Client Builder
  • Features

    • Chat API
    • Workflow API
    • Dataset API
    • Server API
  • Using configurations
  • Customized Configuration
  • v0.x
  • Changelog
  • 简体中文
  • English
GitHub
  • Guide
  • Getting-started
  • Install
  • Configure
  • Client Builder
  • Features

    • Chat API
    • Workflow API
    • Dataset API
    • Server API
  • Using configurations
  • Customized Configuration
  • v0.x
  • Changelog
  • 简体中文
  • English
GitHub
  • Guide

    • Guide
    • Getting-started
    • Install
    • Configure
    • Client Builder
  • Features

    • Chat API
    • Workflow API
    • Dataset API
    • Server API

Getting-started

Let's go through a simple demo to introduce how to use dify-spring-boot-starter features.

Initialization

Create an empty Spring Boot project,Here we are using version 3.2.0 .

If you are using the 2.x version of Spring Boot, please refer to the install。

Adding Dependencies

Configuration

Add the configuration to application.yml:

dify:
  url: http://192.168.1.10 # Please replace with the actual Dify service address
  server:
    email: admin@admin.com # Please replace the actual Dify service mailbox, if you do not need to call the server-related interfaces can not be filled in!
    password: admin123456 # Please replace the password with the actual Dify service password, if you don't need to call the server-related interfaces can not be filled in!
  dataset:
    api-key: dataset-aaabbbcccdddeeefffggghhh # Please replace with the actual Dify dataset API key, if you don't need to call the dataset-related interfaces can not be filled in!

Use

Getting Message Suggestion Example


@Service
public class DifyChatService {

    @Resource
    private DifyChat difyChat;


    public List<String> messagesSuggested(String messageId, String apiKey, String userId) {
        return difyChat.messagesSuggested(messageId, apiKey, userId);
    }
}

Wrap-up

With these few simple steps, we have implemented the dify interface call.

For more usage references check the examples

Edit this page on GitHub
Last Updated: 4/16/25, 9:37 AM
Prev
Guide
Next
Install