current version:

<dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-openfeign</artifactId>
            <version>2.2.3.RELEASE</version>
        </dependency>
private CompletableFuture<ResultBase<List<UserDeviceInfoRes>>> airCleanOfUser() {
        return CompletableFuture.supplyAsync(() -> airCleanerFeign.user());
    }

    private CompletableFuture<ResultBase<List<UserDeviceInfoRes>>> footMachineOfUser() {
        return CompletableFuture.supplyAsync(() -> footMachineFeign.user());
    }
System.err.println(airCleanOfUser().get().getData());
System.err.println(footMachineOfUser().get().getData());

Such writing cannot return normally. Even delaying the main thread will not work. But,

private CompletableFuture<ResultBase<List<UserDeviceInfoRes>>> airCleanOfUser() {
        return CompletableFuture.completedFuture(airCleanerFeign.user());
    }

    private CompletableFuture<ResultBase<List<UserDeviceInfoRes>>> footMachineOfUser() {
        return CompletableFuture.completedFuture(footMachineFeign.user());
    }
System.err.println(airCleanOfUser().get().getData());
System.err.println(footMachineOfUser().get().getData());

Can return.

It is different from what I imagined, what version can support completableFuture.supplyAsync or method. Thank~

Comment From: OlgaMaciaszek

Hello, @impactCn, please provide a minimal, complete, verifiable example that reproduces the issue.

Comment From: spring-cloud-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: impactCn

@FeignClient(name = "service-name")
public interface WifiFeign extends WifiDeviceFeign {
    @PostMapping("wifiInfo")
    ResultBase<List<WifiDeviceInfoRes>> wifiInfo();
}

@RestController
@RequestMapping("device")
public class DeviceController {

    @Autowired
    private WifiFeign  feign;

    @PostMapping("wifiInfo")
    public ResultBase wifiInfo() {
        try {
            return task().get();
        } catch (InterruptedException | ExecutionException e) {
            e.printStackTrace();
        } finally {
            return null;
        }
    }

    private CompletableFuture<ResultBase<List<WifiDeviceInfoRes>>> task() {
        RequestContextHolder.setRequestAttributes(RequestContextHolder.getRequestAttributes(), true);
        return CompletableFuture.supplyAsync(() -> feign.wifiInfo());
    }
}

Comment From: OlgaMaciaszek

@impactCn Please provide a sample as a link to a GitHub project that can be run and verified by us, without us having to add demo code to make the sample compile.

Comment From: spring-cloud-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.