{"id":85476,"date":"2019-01-02T16:00:04","date_gmt":"2019-01-02T14:00:04","guid":{"rendered":"https:\/\/www.javacodegeeks.com\/?p=85476"},"modified":"2019-01-02T11:44:25","modified_gmt":"2019-01-02T09:44:25","slug":"native-microservices-sparkjava-graal","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2019\/01\/native-microservices-sparkjava-graal.html","title":{"rendered":"Native microservices with SparkJava and Graal"},"content":{"rendered":"<p>Microservices written with <a href=\"http:\/\/sparkjava.com\/\">SparkJava<\/a> are just plain Java code using a standard Java library. No annotation magic, just code. The advantage of this simple style of programming is that it is, well, simple. It&#8217;s so simple that <strong>the <a href=\"https:\/\/www.graalvm.org\/\">Graal<\/a> native compiler just compiles it without blinking<\/strong>, something which is currently very difficult with more complex frameworks like Spring, for example.<\/p>\n<p>The SparkJava\/Graal combination is interesting in its own right and people&#8217;s experiences with it are <a href=\"https:\/\/royvanrijn.com\/blog\/2018\/09\/part-2-native-microservice-in-graalvm\/\">beginning<\/a> to <a href=\"https:\/\/zeringue.io\/post\/graalvm-gradle-docker\/\">appear<\/a>. Furthermore as a Java library it should be possible to use it from other JVM based languages and I was wondering how Graal would cope with that. In fact it turned out to be straightforward and in this post we&#8217;ll see how easy it is to build <strong>native microservice binaries for Java, Kotlin and even Clojure<\/strong>.<\/p>\n<h2>Getting started<\/h2>\n<p>If you haven&#8217;t come across Graal before I suggest you head over to their <a href=\"https:\/\/www.graalvm.org\/\">website<\/a> and take a look at what it offers. Here we are using the native compilation feature but in reality that&#8217;s just scratching the surface.<\/p>\n<p>To use Graal first you&#8217;ll need to install the latest version of the Graal SDK. As of writing this is <code>1.0.0-rc9<\/code>. I did it using <a href=\"https:\/\/sdkman.io\/\">SdkMan<\/a>:<\/p>\n<pre class=\"brush:java\">sdk install java 1.0.0-rc9-graal<\/pre>\n<p>And from then on<\/p>\n<pre class=\"brush:java\">sdk use java 1.0.0-rc9-graal<\/pre>\n<p>Then create a basic Gradle project and add the minimum dependencies:<\/p>\n<pre class=\"brush:java\">dependencies {\n    compile \"com.sparkjava:spark-core:2.7.2\"\n    compile \"org.slf4j:slf4j-simple:1.7.13\"\n}<\/pre>\n<p>(I&#8217;ll assume you are already familiar with Gradle, if you prefer you can <a href=\"http:\/\/john-hearn.info\/articles\/native-sparkjava-graal\">do it with Maven<\/a>. Note that it&#8217;s important the Slf4j implementation you choose matches the version required by SparkJava.)<\/p>\n<p>With SparkJava a microservice endpoint is essentially a binding, or <code>route<\/code> between a path and a callback in the form of a lambda expression. This is the standard &#8220;hello world&#8221; example we&#8217;ll be using as a base. Real world services would, of course, make use of the request and response objects. See the <a href=\"http:\/\/sparkjava.com\/documentation#getting-started\">documentation<\/a> for more detailed information.<\/p>\n<pre class=\"brush:java\">import static spark.Spark.*;\n\npublic class HelloWorld {\n    public static void main(String[] args) {\n        get(\"\/sayHello\", (req, res) -&gt; \"Hello world!\");\n    }\n}<\/pre>\n<p>To run it as a command line program it&#8217;s convenient to copy all the dependencies together into the same directory. We can also do that with Gradle.<\/p>\n<pre class=\"brush:java\">task copyDependencies(type: Copy) {\n    from configurations.default\n    into 'build\/libs'\n    shouldRunAfter jar\n}\n\nassemble.dependsOn copyDependencies<\/pre>\n<p>Build the service and run it to check it works.<\/p>\n<pre class=\"brush:java\">&gt; .\/gradlew clean assemble<\/pre>\n<pre class=\"brush:java\">&gt; java -cp \"build\/libs\/*\" HelloWorld\n...\n[Thread-0] INFO org.eclipse.jetty.server.Server - Started @363ms<\/pre>\n<pre class=\"brush:java\">&gt; curl localhost:4567\/sayHello\nHello World!<\/pre>\n<p>Let&#8217;s compile it to a native binary using Graal. The command is thankfully very similar to the <code>java<\/code> command:<\/p>\n<pre class=\"brush:java\">&gt; native-image -cp \"build\/libs\/*\" HelloWorld\n...\nBuild on Server(pid: 31197, port: 52737)*\n[helloworld:31197]    classlist:   2,142.65 ms\n[helloworld:31197]        (cap):   2,154.21 ms\n...\n...\n[helloworld:31197]        write:     443.13 ms\n[helloworld:31197]      [total]:  56,525.52 ms<\/pre>\n<p>Now we should have our native binary in the current directory. Let&#8217;s run it:<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<pre class=\"brush:java\">&gt; .\/helloworld\n...\n[Thread-2] INFO org.eclipse.jetty.server.Server - Started @2ms<\/pre>\n<pre class=\"brush:java\">&gt; curl localhost:4567\/sayHello\nHello World!<\/pre>\n<p>The executable is 14Mb but look at that start time, <strong>2ms<\/strong>, basically instantaneous! Memorywise, it wouldn&#8217;t be wise to pay too much attention to <code>top<\/code> but it is clear that removing the JVM from the runtime has its advantages. This is especially important in microservices systems where a large number of independent processes are deployed.<\/p>\n<h2>How about Kotlin?<\/h2>\n<p><a href=\"https:\/\/kotlinlang.org\/\">Kotlin<\/a> is a JVM language that is picking up momentum and not without reason. Its mix of functional style and OO features, seamless Java interoperability and terse syntax make it a good language for general use and obvious replacement for Java. To build our service with Kotlin first we to add the Kotlin library dependency to Gradle (as of writing the version is v1.3.10).<\/p>\n<pre class=\"brush:java\">dependencies {\n...\n    compile \"org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.10\"\n}<\/pre>\n<p>And to use the Kotlin compiler plugin.<\/p>\n<pre class=\"brush:java\">plugins {\n    id 'org.jetbrains.kotlin.jvm' version '1.3.10'\n}<\/pre>\n<p>With Kotlin our absurdly simple microservice becomes even simpler.<\/p>\n<pre class=\"brush:java\">import spark.Spark.*\n\nfun main(args: Array&lt;String&gt;) {\n    get(\"\/sayHello\") { req, res -&gt; \"Hello World!\" }\n}<\/pre>\n<p>Build the service and run it to check it works.<\/p>\n<pre class=\"brush:java\">&gt; .\/gradlew clean assemble<\/pre>\n<pre class=\"brush:java\">&gt; java -cp \"build\/libs\/*\" HelloWorldKt\n...\n[Thread-0] INFO org.eclipse.jetty.server.Server - Started @363ms<\/pre>\n<pre class=\"brush:java\">&gt; curl localhost:4567\/sayHello\nHello World!<\/pre>\n<p>Let&#8217;s compile it natively. Because it <em>is<\/em> Java, the command is nearly identical to the Java version (the Kotlin compiler automatically adds the Kt suffix to generated classes).<\/p>\n<pre class=\"brush:java\">&gt; native-image -cp \"build\/libs\/*\" HelloWorldKt\nBuild on Server(pid: 53242, port: 51191)\n[helloworldkt:53242]    classlist:     783.03 ms\n[helloworldkt:53242]        (cap):   2,139.45 ms\n...\n[helloworldkt:53242]        write:     591.88 ms\n[helloworldkt:53242]      [total]:  53,074.15 ms<\/pre>\n<p>And run it:<\/p>\n<pre class=\"brush:java\">&gt; .\/helloworldkt\n...\n[Thread-2] INFO org.eclipse.jetty.server.Server - Started @2ms<\/pre>\n<pre class=\"brush:java\">&gt; curl localhost:4567\/sayHello\nHello World!<\/pre>\n<p>The executable is nearly identical in size and start-up speed to the Java version, as would be expected since it&#8217;s essentially the same code.<\/p>\n<p>This is a basic example but the combination of <em>Kotlin<\/em> for <strong>implementation simplicity<\/strong>, <em>SparkJava<\/em> for <strong>microservice simplicity<\/strong> and <em>Graal<\/em> for <strong>deployment simplicity<\/strong> is a very attractive proposition for microservice development.<\/p>\n<p>Nonetheless, apart from a nicer syntax, Kotlin is very similar to Java. There are other JVM languages which we can use which might push Graal further.<\/p>\n<h2>The need for Clojure<\/h2>\n<p>Using Clojure to build microservices is an interesting idea. Services are naturally functional in nature, in fact a service <em>is<\/em> a function and the dynamic nature of the language might make it ideal for some data-centric situations.<\/p>\n<p>Rather than using Gradle, we&#8217;ll start with a new <a href=\"https:\/\/leiningen.org\/\">Leiningen<\/a> project:<\/p>\n<pre class=\"brush:java\">lein new hello-clojure<\/pre>\n<p>The dependencies go in the main <code>project.clj<\/code> file as well as the name of the main class that we&#8217;ll run to start the server.<\/p>\n<pre class=\"brush:java\">:dependencies [[org.clojure\/clojure \"1.9.0\"]\n                 [com.sparkjava\/spark-core \"2.7.2\"]\n                 [org.slf4j\/slf4j-simple \"1.7.13\"]]\n  :main hello_clojure.core)<\/pre>\n<p>Clojure is interoperable with Java but not to the same extent that Kotlin is. To overcome the differences I wrote a couple of adapters to allow idiomatic clojure code to use SparkJava&#8217;s classes.<\/p>\n<pre class=\"brush:java\">(ns hello_clojure.core\n  (:gen-class)\n  (:import (spark Spark Response Request Route)))\n\n(defn route [handler]\n  (reify Route\n    (handle [_ ^Request request ^Response response]\n      (handler request response))))\n\n(defn get [endpoint routefn]\n  (Spark\/get endpoint (route routefn)))<\/pre>\n<p>(I later found a nice <a href=\"https:\/\/lispchronicles.com\/shortn.html\">article<\/a> with a complete service using Clojure and SparkJava. Their adapters were slightly better than mine so I&#8217;ve incorporated some ideas from that article in what follows.)<\/p>\n<p>Then we&#8217;re ready to create the controller which we do from the main method so that it&#8217;s easy to invoke from the command line. Note also that in the above we used the <code>gen-class<\/code> directive to ensure the main class is specified in the Manifest:<\/p>\n<pre class=\"brush:java\">(defn -main []\n  (get \"\/sayHello\" (fn [req resp] \"Hello World!!\")))<\/pre>\n<p>To simplify the generation of the service we can build a self-contained jar using Leiningen.<\/p>\n<pre class=\"brush:java\">&gt; lein clean &amp;&amp; lein uberjar<\/pre>\n<p>As before, we first check that the service works as normal Java:<\/p>\n<pre class=\"brush:java\">$ java -cp target\/hello-clojure-0.1.0-SNAPSHOT-standalone.jar hello_clojure.core\n...\n[Thread-0] INFO org.eclipse.jetty.server.Server - Started @1033ms<\/pre>\n<pre class=\"brush:java\">&gt; curl localhost:4567\/sayHello\nHello World!<\/pre>\n<p>Compiling to a native image is as simple as the previous examples with Java and Kotlin.<\/p>\n<pre class=\"brush:java\">&gt; native-image -cp target\/hello-clojure-0.1.0-SNAPSHOT-standalone.jar hello_clojure.core\nBuild on Server(pid: 35646, port: 53994)*\n[hello_clojure.core:35646]    classlist:   2,704.82 ms\n[hello_clojure.core:35646]        (cap):     909.58 ms\n...\n[hello_clojure.core:35646]        write:     647.23 ms\n[hello_clojure.core:35646]      [total]:  54,900.61 ms<\/pre>\n<p>And run it:<\/p>\n<pre class=\"brush:java\">&gt; .\/helloworld_clojure\n...\n[Thread-2] INFO org.eclipse.jetty.server.Server - Started @2ms<\/pre>\n<pre class=\"brush:java\">&gt; curl localhost:4567\/sayHello\nHello World!<\/pre>\n<p>Once again the native binary is roughly 15M and again the start-up time is almost instantaneous.<\/p>\n<h2>Conclusion<\/h2>\n<p>This use of Graal with other JVM based languages is a very attractive proposition and worth more investigation, however I do have some concerns about production use. Mainly if something were to go wrong there is very little information in the public domain to help you out, and still less outside of pure Java. On the other hand these are all open source projects so nothing is hidden :)<\/p>\n<p>Another limitation is that many libraries simply don&#8217;t work with Graal. This is not altogether negative because it will encourage us to go back to simple coding practices however you may have a dependency which you can&#8217;t change and this could cause major hassle. I think the main drawback initially will be reflection driven mapping, whether of the serialisation or ORM varieties. Quite a lot of effort is already being done to make many libraries and <a href=\"https:\/\/github.com\/micronaut-projects\/micronaut-core\/issues\/329\">frameworks<\/a> <a href=\"https:\/\/jira.spring.io\/browse\/SPR-16991\">compatible<\/a> with Graal but it&#8217;s still early days.<\/p>\n<p>A third, primarily practical, consideration is the extremely slow compilation of the native image. Even this very simple example takes almost a minute to build. Of course you could do development compiling only to bytecode but then compatibility problems could slip through. A continuous build pipeline and comprehensive tests would be a way to mitigate this risk.<\/p>\n<p>Obviously there is a lot more to do to make this a fully functional service, and appropriate considerations to be made before moving to production use, but if we choose to keep using simple code then problems will be minimised.<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td>Published on Java Code Geeks with permission by Sandro Mancuso, partner at our <a href=\"\/\/www.javacodegeeks.com\/join-us\/jcg\/\" target=\"_blank\" rel=\"noopener\">JCG program<\/a>. See the original article here: <a href=\"https:\/\/codurance.com\/2018\/12\/28\/native-microservices-with-sparkjava-and-graal\/\" target=\"_blank\" rel=\"noopener\">Native microservices with SparkJava and Graal<\/a><\/p>\n<p>Opinions expressed by Java Code Geeks contributors are their own.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Microservices written with SparkJava are just plain Java code using a standard Java library. No annotation magic, just code. The advantage of this simple style of programming is that it is, well, simple. It&#8217;s so simple that the Graal native compiler just compiles it without blinking, something which is currently very difficult with more complex &hellip;<\/p>\n","protected":false},"author":69412,"featured_media":93,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[1842,1841,1208,960,958],"class_list":["post-85476","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-clojure","tag-graal","tag-kotlin","tag-microservices","tag-spark"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Native microservices with SparkJava and Graal - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Interested to learn about SparkJava? Check our article explaining how the SparkJava\/Graal combination is interesting in writing native microservices\" \/>\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\/2019\/01\/native-microservices-sparkjava-graal.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Native microservices with SparkJava and Graal - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Interested to learn about SparkJava? Check our article explaining how the SparkJava\/Graal combination is interesting in writing native microservices\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2019\/01\/native-microservices-sparkjava-graal.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:published_time\" content=\"2019-01-02T14:00:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/clojure-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=\"John Hearn\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"John Hearn\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/01\\\/native-microservices-sparkjava-graal.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/01\\\/native-microservices-sparkjava-graal.html\"},\"author\":{\"name\":\"John Hearn\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/41f6b2936ff0fb3bed924e21410e816a\"},\"headline\":\"Native microservices with SparkJava and Graal\",\"datePublished\":\"2019-01-02T14:00:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/01\\\/native-microservices-sparkjava-graal.html\"},\"wordCount\":1196,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/01\\\/native-microservices-sparkjava-graal.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/clojure-logo.jpg\",\"keywords\":[\"Clojure\",\"Graal\",\"Kotlin\",\"Microservices\",\"Spark\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/01\\\/native-microservices-sparkjava-graal.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/01\\\/native-microservices-sparkjava-graal.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/01\\\/native-microservices-sparkjava-graal.html\",\"name\":\"Native microservices with SparkJava and Graal - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/01\\\/native-microservices-sparkjava-graal.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/01\\\/native-microservices-sparkjava-graal.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/clojure-logo.jpg\",\"datePublished\":\"2019-01-02T14:00:04+00:00\",\"description\":\"Interested to learn about SparkJava? Check our article explaining how the SparkJava\\\/Graal combination is interesting in writing native microservices\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/01\\\/native-microservices-sparkjava-graal.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/01\\\/native-microservices-sparkjava-graal.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/01\\\/native-microservices-sparkjava-graal.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/clojure-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/clojure-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/01\\\/native-microservices-sparkjava-graal.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\":\"Native microservices with SparkJava and Graal\"}]},{\"@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\\\/41f6b2936ff0fb3bed924e21410e816a\",\"name\":\"John Hearn\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/81e6dd92360febfaabfee1945dcdddfeaa02bf2611cdde1c8dd1aec6d1060280?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/81e6dd92360febfaabfee1945dcdddfeaa02bf2611cdde1c8dd1aec6d1060280?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/81e6dd92360febfaabfee1945dcdddfeaa02bf2611cdde1c8dd1aec6d1060280?s=96&d=mm&r=g\",\"caption\":\"John Hearn\"},\"description\":\"John has always loved building stuff and understanding how things work. As a teenager he would write computer games for his friends or build amplifiers in his bedroom out of old music equipment. Building on his interests, he studied Physics at university before becoming an Electronics Engineer, gradually specialising in embedded software and then software in general. During his career he has been lucky enough to work in a variety of companies from small startups to large corporations, in the private and public sectors and in three countries.\",\"sameAs\":[\"https:\\\/\\\/codurance.com\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/john-hearn\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Native microservices with SparkJava and Graal - Java Code Geeks","description":"Interested to learn about SparkJava? Check our article explaining how the SparkJava\/Graal combination is interesting in writing native microservices","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\/2019\/01\/native-microservices-sparkjava-graal.html","og_locale":"en_US","og_type":"article","og_title":"Native microservices with SparkJava and Graal - Java Code Geeks","og_description":"Interested to learn about SparkJava? Check our article explaining how the SparkJava\/Graal combination is interesting in writing native microservices","og_url":"https:\/\/www.javacodegeeks.com\/2019\/01\/native-microservices-sparkjava-graal.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2019-01-02T14:00:04+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/clojure-logo.jpg","type":"image\/jpeg"}],"author":"John Hearn","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"John Hearn","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2019\/01\/native-microservices-sparkjava-graal.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/01\/native-microservices-sparkjava-graal.html"},"author":{"name":"John Hearn","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/41f6b2936ff0fb3bed924e21410e816a"},"headline":"Native microservices with SparkJava and Graal","datePublished":"2019-01-02T14:00:04+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/01\/native-microservices-sparkjava-graal.html"},"wordCount":1196,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/01\/native-microservices-sparkjava-graal.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/clojure-logo.jpg","keywords":["Clojure","Graal","Kotlin","Microservices","Spark"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2019\/01\/native-microservices-sparkjava-graal.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2019\/01\/native-microservices-sparkjava-graal.html","url":"https:\/\/www.javacodegeeks.com\/2019\/01\/native-microservices-sparkjava-graal.html","name":"Native microservices with SparkJava and Graal - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/01\/native-microservices-sparkjava-graal.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/01\/native-microservices-sparkjava-graal.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/clojure-logo.jpg","datePublished":"2019-01-02T14:00:04+00:00","description":"Interested to learn about SparkJava? Check our article explaining how the SparkJava\/Graal combination is interesting in writing native microservices","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/01\/native-microservices-sparkjava-graal.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2019\/01\/native-microservices-sparkjava-graal.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2019\/01\/native-microservices-sparkjava-graal.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/clojure-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/clojure-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2019\/01\/native-microservices-sparkjava-graal.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":"Native microservices with SparkJava and Graal"}]},{"@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\/41f6b2936ff0fb3bed924e21410e816a","name":"John Hearn","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/81e6dd92360febfaabfee1945dcdddfeaa02bf2611cdde1c8dd1aec6d1060280?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/81e6dd92360febfaabfee1945dcdddfeaa02bf2611cdde1c8dd1aec6d1060280?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/81e6dd92360febfaabfee1945dcdddfeaa02bf2611cdde1c8dd1aec6d1060280?s=96&d=mm&r=g","caption":"John Hearn"},"description":"John has always loved building stuff and understanding how things work. As a teenager he would write computer games for his friends or build amplifiers in his bedroom out of old music equipment. Building on his interests, he studied Physics at university before becoming an Electronics Engineer, gradually specialising in embedded software and then software in general. During his career he has been lucky enough to work in a variety of companies from small startups to large corporations, in the private and public sectors and in three countries.","sameAs":["https:\/\/codurance.com"],"url":"https:\/\/www.javacodegeeks.com\/author\/john-hearn"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/85476","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\/69412"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=85476"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/85476\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/93"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=85476"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=85476"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=85476"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}