{"id":55083,"date":"2016-04-19T16:00:00","date_gmt":"2016-04-19T13:00:00","guid":{"rendered":"https:\/\/www.javacodegeeks.com\/?p=55083"},"modified":"2016-04-18T14:05:42","modified_gmt":"2016-04-18T11:05:42","slug":"spring-async-javas-8-completablefuture","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2016\/04\/spring-async-javas-8-completablefuture.html","title":{"rendered":"Spring Async and Java&#8217;s 8 CompletableFuture"},"content":{"rendered":"<p>It is known that I am not the biggest fan of\u00a0<a style=\"line-height: 1.5;\" href=\"https:\/\/spring.io\/\">Spring<\/a><span style=\"line-height: 1.5;\">, but at the time being I work for an organization that maintains too many projects utilizing Spring (in different forms and versions). I still remain skeptic towards Spring, of course there are some very nice ideas, there are some nice (too many) abstractions, there are some very handy &#8216;shortcuts&#8217; to bootstrap complex projects. I am not going to elaborate on the things I don&#8217;t like in this post.<\/span><\/p>\n<p>One thing I like on Spring&#8217;s documentation, is their getting started guides. Well written and concrete. I was reading through, a short guide, for &#8216;\u00a0<a href=\"http:\/\/docs.spring.io\/spring\/docs\/current\/javadoc-api\/org\/springframework\/scheduling\/annotation\/Async.html\">Async<\/a>&#8216; method execution, through\u00a0<a href=\"http:\/\/projects.spring.io\/spring-boot\/\">SpringBoot<\/a> \/RestApi [\u00a0<a href=\"https:\/\/spring.io\/guides\/gs\/async-method\/\">link<\/a>] .<\/p>\n<p>So this is this the implementation of the example &#8216;asynchronous&#8217;\u00a0findUser() method. Full source\u00a0<a href=\"https:\/\/github.com\/spring-guides\/gs-async-method\/blob\/master\/complete\/src\/main\/java\/hello\/GitHubLookupService.java\">here<\/a>.<\/p>\n<pre class=\"brush:java\">@Async\r\npublic Future&lt;User&gt; findUser(String user) throws InterruptedException {\r\n  System.out.println(\"Looking up \" + user);\r\n  User results = restTemplate.getForObject(\"https:\/\/api.github.com\/users\/\" + user, User.class);\r\n  \/\/ Artificial delay of 1s for demonstration purposes\r\n  Thread.sleep(1000L);\r\n  return new AsyncResult&lt;User&gt;(results);\r\n}<\/pre>\n<p>I was wondering why there is still a &#8216;\u00a0Future&#8217; in the example, while we have been introduced Java8,\u00a0<a href=\"https:\/\/docs.oracle.com\/javase\/8\/docs\/api\/java\/util\/concurrent\/CompletableFuture.html\">CompletableFuture<\/a>.\u00a0<i>I guess the original authors want to preserve backwards compatibility with previous versions of Java (6 \/ 7 ) &#8211; where this construct is not available<\/i>.<\/p>\n<p>It seems that someone else had the same question, and wrote a very nice example\u00a0<a href=\"http:\/\/geowarin.github.io\/completable-futures-with-spring-async.html\">here<\/a>. In one of the comments, you can see a hint that from\u00a0<a href=\"https:\/\/docs.spring.io\/spring\/docs\/current\/spring-framework-reference\/html\/new-in-4.2.html\">version 4.2 <\/a>and onward the Spring API, would be compatible with the use of\u00a0CompletableFuture, on top of\u00a0Future &amp;\u00a0AsyncResult which are already provided. I thought, `\u00a0<i>well it&#8217;s a shame, why not try it or even document it, because if someone lands on this example, he\/she might stay with the current implementation<\/i>` &#8211; why not use something standard?.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p>So I decided to make a tiny change, remove\u00a0Future and replace it with\u00a0CompletableFuture, also comment out the calls to\u00a0<a href=\"https:\/\/docs.oracle.com\/javase\/7\/docs\/api\/java\/util\/concurrent\/Future.html#isDone%28%29\">Future.isDone()<\/a> and replace it with the very handy\u00a0<a href=\"https:\/\/docs.oracle.com\/javase\/8\/docs\/api\/java\/util\/concurrent\/CompletableFuture.html#allOf-java.util.concurrent.CompletableFuture...-\">CompletableFuture.allof()<\/a> method.<\/p>\n<p>So I changed the return type on the &#8216;service&#8217; method\u00a0while, updating the, caller code &#8211; to sync on all 3 futures and once allof() them were done, we could print the results.<\/p>\n<pre class=\"brush:java\">package hello;\r\n\r\nimport java.util.concurrent.CompletableFuture;\r\nimport java.util.concurrent.Future;\r\n\r\nimport org.springframework.scheduling.annotation.Async;\r\nimport org.springframework.scheduling.annotation.AsyncResult;\r\nimport org.springframework.stereotype.Service;\r\nimport org.springframework.web.client.RestTemplate;\r\n\r\n@Service\r\npublic class GitHubLookupService {\r\n\r\n    RestTemplate restTemplate = new RestTemplate();\r\n\r\n    @Async\r\n    public CompletableFuture findUser(String user) throws InterruptedException {\r\n        System.out.println(\"Looking up \" + user);\r\n        User results = restTemplate.getForObject(\"https:\/\/api.github.com\/users\/\" + user, User.class);\r\n        \/\/ Artificial delay of 1s for demonstration purposes\r\n        Thread.sleep(1000L);\r\n        return CompletableFuture.completedFuture(results);\r\n    }\r\n\r\n}\r\n<\/pre>\n<p>The modified, example can be found\u00a0<b><a href=\"https:\/\/github.com\/javapapo\/projects-from-blog\/tree\/master\/spring-async-complfuture\">here<\/a><\/b>. I found\u00a0<a href=\"http:\/\/www.nurkiewicz.com\/2013\/05\/java-8-definitive-guide-to.html\">this<\/a> and\u00a0<a href=\"http:\/\/www.nurkiewicz.com\/2013\/05\/java-8-completablefuture-in-action.html\">this<\/a> blog posts from\u00a0<a href=\"https:\/\/github.com\/nurkiewicz\">Tomasz Nirkewicz<\/a>, a very nice and pragmatic walk through of\u00a0CompletableFuture, rich method list. There is also a quite complete presentation by my favorite\u00a0<a href=\"https:\/\/www.devoxx.com\/\">Devoxx<\/a> Speaker ,\u00a0<a href=\"http:\/\/blog.paumard.org\/en\/\">Jose Paumard<\/a> you can find it\u00a0<a href=\"https:\/\/www.youtube.com\/watch?v=HdnHmbFg_hw\">here<\/a>.<\/p>\n<pre class=\"brush:java\">@Override\r\n    public void run(String... args) throws Exception {\r\n        \/\/ Start the clock\r\n        long start = System.currentTimeMillis();\r\n\r\n        \/\/ Kick of multiple, asynchronous lookups\r\n        CompletableFuture page1 = gitHubLookupService.findUser(\"PivotalSoftware\");\r\n        CompletableFuture page2 = gitHubLookupService.findUser(\"CloudFoundry\");\r\n        CompletableFuture page3 = gitHubLookupService.findUser(\"Spring-Projects\");\r\n\r\n        \/\/ Wait until they are all done\r\n        \/\/while (!(page1.isDone() &amp;&amp; page2.isDone() &amp;&amp; page3.isDone())) {\r\n          \/\/  Thread.sleep(10); \/\/10-millisecond pause between each check\r\n        \/\/}\r\n\r\n        \/\/wait until all they are completed.\r\n        CompletableFuture.allOf(page1,page2,page3).join();\r\n        \/\/I could join as well if interested.\r\n\r\n        \/\/ Print results, including elapsed time\r\n        System.out.println(\"Elapsed time: \" + (System.currentTimeMillis() - start) +\" ms\");\r\n        System.out.println(page1.get());\r\n        System.out.println(page2.get());\r\n        System.out.println(page3.get());\r\n    }\r\n<\/pre>\n<p>Links<\/p>\n<ul>\n<li><a href=\"https:\/\/spring.io\/guides\/gs\/async-method\/\">https:\/\/spring.io\/guides\/gs\/async-method\/<\/a><\/li>\n<li><a href=\"http:\/\/geowarin.github.io\/completable-futures-with-spring-async.html\">http:\/\/geowarin.github.io\/completable-futures-with-spring-async.html<\/a><\/li>\n<li><a href=\"http:\/\/www.nurkiewicz.com\/2013\/05\/java-8-completablefuture-in-action.html\">http:\/\/www.nurkiewicz.com\/2013\/05\/java-8-completablefuture-in-action.html<\/a><\/li>\n<li><a href=\"http:\/\/www.nurkiewicz.com\/2013\/05\/java-8-definitive-guide-to.html\">http:\/\/www.nurkiewicz.com\/2013\/05\/java-8-definitive-guide-to.html<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/javapapo\/projects-from-blog\/tree\/master\/spring-async-complfuture\">https:\/\/github.com\/javapapo\/projects-from-blog\/tree\/master\/spring-async-complfuture<\/a><\/li>\n<\/ul>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td><span class=\"reference\">Reference: <\/span><\/td>\n<td><a href=\"http:\/\/javapapo.blogspot.com\/2016\/04\/spring-async-and-javas-8.html\">Spring Async and Java&#8217;s 8 CompletableFuture<\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/join-us\/jcg\/\">JCG partner<\/a> Paris Apostolopoulos at the <a href=\"http:\/\/javapapo.blogspot.com\/\">Papo&#8217;s log<\/a> blog.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>It is known that I am not the biggest fan of\u00a0Spring, but at the time being I work for an organization that maintains too many projects utilizing Spring (in different forms and versions). I still remain skeptic towards Spring, of course there are some very nice ideas, there are some nice (too many) abstractions, there &hellip;<\/p>\n","protected":false},"author":94,"featured_media":240,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[30],"class_list":["post-55083","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-spring"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Spring Async and Java&#039;s 8 CompletableFuture - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"It is known that I am not the biggest fan of\u00a0Spring, but at the time being I work for an organization that maintains too many projects utilizing Spring\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2016\/04\/spring-async-javas-8-completablefuture.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Spring Async and Java&#039;s 8 CompletableFuture - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"It is known that I am not the biggest fan of\u00a0Spring, but at the time being I work for an organization that maintains too many projects utilizing Spring\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2016\/04\/spring-async-javas-8-completablefuture.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:author\" content=\"http:\/\/www.facebook.com\/javapapo\" \/>\n<meta property=\"article:published_time\" content=\"2016-04-19T13:00:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Paris Apostolopoulos\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@http:\/\/twitter.com\/javapapo\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Paris Apostolopoulos\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/04\\\/spring-async-javas-8-completablefuture.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/04\\\/spring-async-javas-8-completablefuture.html\"},\"author\":{\"name\":\"Paris Apostolopoulos\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/bd8fdd606ddc2a17944d068771e1ebda\"},\"headline\":\"Spring Async and Java&#8217;s 8 CompletableFuture\",\"datePublished\":\"2016-04-19T13:00:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/04\\\/spring-async-javas-8-completablefuture.html\"},\"wordCount\":430,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/04\\\/spring-async-javas-8-completablefuture.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"keywords\":[\"Spring\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/04\\\/spring-async-javas-8-completablefuture.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/04\\\/spring-async-javas-8-completablefuture.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/04\\\/spring-async-javas-8-completablefuture.html\",\"name\":\"Spring Async and Java's 8 CompletableFuture - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/04\\\/spring-async-javas-8-completablefuture.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/04\\\/spring-async-javas-8-completablefuture.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"datePublished\":\"2016-04-19T13:00:00+00:00\",\"description\":\"It is known that I am not the biggest fan of\u00a0Spring, but at the time being I work for an organization that maintains too many projects utilizing Spring\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/04\\\/spring-async-javas-8-completablefuture.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/04\\\/spring-async-javas-8-completablefuture.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/04\\\/spring-async-javas-8-completablefuture.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"spring-interview-questions-answers\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/04\\\/spring-async-javas-8-completablefuture.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Spring Async and Java&#8217;s 8 CompletableFuture\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/bd8fdd606ddc2a17944d068771e1ebda\",\"name\":\"Paris Apostolopoulos\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6ff4de48bbf21cde9c5ba6c25a50809e924db28bc320e927323dfca30d63c3ea?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6ff4de48bbf21cde9c5ba6c25a50809e924db28bc320e927323dfca30d63c3ea?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6ff4de48bbf21cde9c5ba6c25a50809e924db28bc320e927323dfca30d63c3ea?s=96&d=mm&r=g\",\"caption\":\"Paris Apostolopoulos\"},\"description\":\"Paris is a senior software engineer focusing on J2EE development, loves Business process modelling and is keen on software quality challenges. He is passionate about Java and Java communities. He is a co-founder and administrator of the first Java User Group in greece(JHUG.gr) and occasional speaker on meet-ups and seminars and regular blogger. For his contributions and involvement on the Java community he has been awarded the title of Java Champion in 2007 by Sun Microsystems.\",\"sameAs\":[\"http:\\\/\\\/javapapo.blogspot.com\\\/\",\"http:\\\/\\\/www.facebook.com\\\/javapapo\",\"http:\\\/\\\/gr.linkedin.com\\\/in\\\/javaneze\\\/\",\"https:\\\/\\\/x.com\\\/http:\\\/\\\/twitter.com\\\/javapapo\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/Paris-Apostolopoulos\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Spring Async and Java's 8 CompletableFuture - Java Code Geeks","description":"It is known that I am not the biggest fan of\u00a0Spring, but at the time being I work for an organization that maintains too many projects utilizing Spring","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2016\/04\/spring-async-javas-8-completablefuture.html","og_locale":"en_US","og_type":"article","og_title":"Spring Async and Java's 8 CompletableFuture - Java Code Geeks","og_description":"It is known that I am not the biggest fan of\u00a0Spring, but at the time being I work for an organization that maintains too many projects utilizing Spring","og_url":"https:\/\/www.javacodegeeks.com\/2016\/04\/spring-async-javas-8-completablefuture.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_author":"http:\/\/www.facebook.com\/javapapo","article_published_time":"2016-04-19T13:00:00+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","type":"image\/jpeg"}],"author":"Paris Apostolopoulos","twitter_card":"summary_large_image","twitter_creator":"@http:\/\/twitter.com\/javapapo","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Paris Apostolopoulos","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2016\/04\/spring-async-javas-8-completablefuture.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2016\/04\/spring-async-javas-8-completablefuture.html"},"author":{"name":"Paris Apostolopoulos","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/bd8fdd606ddc2a17944d068771e1ebda"},"headline":"Spring Async and Java&#8217;s 8 CompletableFuture","datePublished":"2016-04-19T13:00:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2016\/04\/spring-async-javas-8-completablefuture.html"},"wordCount":430,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2016\/04\/spring-async-javas-8-completablefuture.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","keywords":["Spring"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2016\/04\/spring-async-javas-8-completablefuture.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2016\/04\/spring-async-javas-8-completablefuture.html","url":"https:\/\/www.javacodegeeks.com\/2016\/04\/spring-async-javas-8-completablefuture.html","name":"Spring Async and Java's 8 CompletableFuture - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2016\/04\/spring-async-javas-8-completablefuture.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2016\/04\/spring-async-javas-8-completablefuture.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","datePublished":"2016-04-19T13:00:00+00:00","description":"It is known that I am not the biggest fan of\u00a0Spring, but at the time being I work for an organization that maintains too many projects utilizing Spring","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2016\/04\/spring-async-javas-8-completablefuture.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2016\/04\/spring-async-javas-8-completablefuture.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2016\/04\/spring-async-javas-8-completablefuture.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","width":150,"height":150,"caption":"spring-interview-questions-answers"},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2016\/04\/spring-async-javas-8-completablefuture.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Spring Async and Java&#8217;s 8 CompletableFuture"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/bd8fdd606ddc2a17944d068771e1ebda","name":"Paris Apostolopoulos","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/6ff4de48bbf21cde9c5ba6c25a50809e924db28bc320e927323dfca30d63c3ea?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/6ff4de48bbf21cde9c5ba6c25a50809e924db28bc320e927323dfca30d63c3ea?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6ff4de48bbf21cde9c5ba6c25a50809e924db28bc320e927323dfca30d63c3ea?s=96&d=mm&r=g","caption":"Paris Apostolopoulos"},"description":"Paris is a senior software engineer focusing on J2EE development, loves Business process modelling and is keen on software quality challenges. He is passionate about Java and Java communities. He is a co-founder and administrator of the first Java User Group in greece(JHUG.gr) and occasional speaker on meet-ups and seminars and regular blogger. For his contributions and involvement on the Java community he has been awarded the title of Java Champion in 2007 by Sun Microsystems.","sameAs":["http:\/\/javapapo.blogspot.com\/","http:\/\/www.facebook.com\/javapapo","http:\/\/gr.linkedin.com\/in\/javaneze\/","https:\/\/x.com\/http:\/\/twitter.com\/javapapo"],"url":"https:\/\/www.javacodegeeks.com\/author\/Paris-Apostolopoulos"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/55083","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/94"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=55083"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/55083\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/240"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=55083"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=55083"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=55083"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}