java - Response object from async rest api in Spring -


i'm using spring-boot create async rest apis. in response, should return completablefuture object or call join() method , return string response. there difference in response time or performance?

@requestmapping public completablefuture<string> get(@requestparam string input) {     completablefuture<string> future = new completablefuture<>();     return completablefuture.supplyasync(() -> "in background"); } 

or return future result

  @requestmapping     public string get(@requestparam string input) {         completablefuture<string> future = new completablefuture<>();         return completablefuture.supplyasync(() -> "in background").join();     } 

for small functions, didn't notice change in response time.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

javascript - How to bind ViewModel Store to View? -

javascript - Solution fails to pass one test with large inputs? -