Skip to content

using CompletableFuture instead of Callable for asynchronous controller in Spring Boot#3190

Merged
wing328 merged 2 commits intoswagger-api:masterfrom
thebignet:asyncCompletableFuture
Jun 28, 2016
Merged

using CompletableFuture instead of Callable for asynchronous controller in Spring Boot#3190
wing328 merged 2 commits intoswagger-api:masterfrom
thebignet:asyncCompletableFuture

Conversation

@thebignet
Copy link
Contributor

No description provided.

@wing328
Copy link
Contributor

wing328 commented Jun 21, 2016

@thebignet thanks for the PR on Spring Boot. I've just merged #3133 into master

Please pull the latest master and rebase the change accordingly.

@thebignet thebignet force-pushed the asyncCompletableFuture branch from 8c2ed57 to 8707ea7 Compare June 21, 2016 15:06
@cbornet
Copy link
Contributor

cbornet commented Jun 21, 2016

I think you can't use CompletableFuture on java7...

@thebignet
Copy link
Contributor Author

thebignet commented Jun 21, 2016

You're right.How about changing the async property to accept java7 or java8 as a value like what is done for dateLibrary ?

Maybe it's simpler to use predefined java8 and async booleans in templates

@thebignet thebignet force-pushed the asyncCompletableFuture branch from 8707ea7 to 8dd4a31 Compare June 21, 2016 16:27
{{/hasMore}}{{/allParams}}){{^java8}};{{/java8}}{{#java8}} {
// do some magic!
return {{#async}}() -> {{/async}}new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK);
return {{#async}}{{^java8}}() -> {{/java8}}{{#java8}}CompletableFuture.completedFuture({{/java8}}{{/async}}new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK){{#async}}){{/async}};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a java8 block so {{^java8}}() -> {{/java8}} is not needed

@thebignet thebignet force-pushed the asyncCompletableFuture branch from 8dd4a31 to 19bb07f Compare June 22, 2016 07:17
@thebignet thebignet force-pushed the asyncCompletableFuture branch from 19bb07f to 2b22efc Compare June 22, 2016 07:19
@cbornet
Copy link
Contributor

cbornet commented Jun 25, 2016

LGTM. Maybe you can update the java8 spring sample ?

@thebignet
Copy link
Contributor Author

Java8 async sample is updated. I used a separate commit, but feel free to squash the branch commit before merging

@wing328 wing328 added this to the v2.2.0 milestone Jun 28, 2016
@wing328 wing328 merged commit 1742223 into swagger-api:master Jun 28, 2016
@wing328
Copy link
Contributor

wing328 commented Jun 28, 2016

@thebignet thanks for the PR. I've merged it into master.

@thebignet thebignet deleted the asyncCompletableFuture branch June 28, 2016 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants