[Java Practical] Feign calls the file download service interface to implement the file download function

Preface

Recently, it is necessary to implement Feign to call the file download interface of the service provider to perform the file download function. Here is a simple record of the implementation of the function.

1. Function realization

By calling the service provider's file download interface, the file transfer stream data is received through feign.Response , and the service consumer then converts the data

2. Specific steps

1.Introduce dependencies

First, introduce Feign's dependencies into the project. You can use Maven for management and add the following dependencies to your pom.xml file:

<dependency>
	<groupId>io.github.openfeign</groupId>
	<artifactId>feign-core</artifactId>
</dependency>

2. Service provider

Create a method that calls the file download service interface. You can call this method in business logic to implement file download:

1. Download file interface

Guess you like

Origin blog.csdn.net/qq_34383510/article/details/130626853