{"id":94575,"date":"2019-08-05T07:00:19","date_gmt":"2019-08-05T04:00:19","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/?p=94575"},"modified":"2019-08-02T13:04:33","modified_gmt":"2019-08-02T10:04:33","slug":"java-single-dependency-dockerized-http-endpoint","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2019\/08\/java-single-dependency-dockerized-http-endpoint.html","title":{"rendered":"Java Single Dependency Dockerized HTTP Endpoint"},"content":{"rendered":"<p>In this article, we will create a Java-based HTTP endpoint, make an executable jar out of it, pack it up in Docker and run it locally in no time.<\/p>\n<p>This article is intended for beginners, who want to looking for a simple walk-through for running a Java application in Docker.<\/p>\n<p>The vast majority of examples out there describing Java applications in a Dockerized environment include the usage of heavy frameworks like Spring Boot. We want to show here that you don&#8217;t need much to get an endpoint running with Java in Docker.<\/p>\n<p>In fact, we will only use a single library as a dependency:<a target=\"_blank\" rel=\"noreferrer noopener\" href=\"https:\/\/search.maven.org\/artifact\/com.envimate.httpmate\/core\/\">HttpMate core<\/a>. For this example, we&#8217;ll use the<a target=\"_blank\" rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/envimate\/httpmate#low-level-httpmate\">LowLevel builder of HttpMate<\/a>&nbsp;with a single HTTP handler.<\/p>\n<p>The environment used for this example<\/p>\n<ul class=\"wp-block-list\">\n<li>Java 11+<\/li>\n<li>Maven 3.5+<\/li>\n<li>Java-friendly IDE<\/li>\n<li>Docker version 18+<\/li>\n<li>Basic understanding of HTTP\/bash\/Java<\/li>\n<\/ul>\n<p>The final result is available in<a target=\"_blank\" rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/envimate\/simple-java-http-docker\">this git repo<\/a>.<\/p>\n<h2 class=\"wp-block-heading\">Organizing the Project<\/h2>\n<p>Let&#8217;s create our initial project structure: <\/p>\n<pre class=\"brush:bash\">\nmkdir -p simple-java-http-docker\/src\/main\/java\/com\/envimate\/examples\/http\n<\/pre>\n<p>Let&#8217;s start with the project&#8217;s pom file in the root directory that we called here\u00a0<code>simple-java-http-docker<\/code>: <\/p>\n<pre class=\"brush:xml\">\n&lt;project xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" xmlns=\"http:\/\/maven.apache.org\/POM\/4.0.0\"\n         xsi:schemaLocation=\"http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/maven-v4_0_0.xsd\"&gt;\n    &lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;\n\n    &lt;groupId&gt;com.envimate.examples&lt;\/groupId&gt;\n    &lt;artifactId&gt;simple-java-http-docker&lt;\/artifactId&gt;\n    &lt;version&gt;0.0.1&lt;\/version&gt;\n\n    &lt;dependencies&gt;\n        &lt;dependency&gt;\n            &lt;groupId&gt;com.envimate.httpmate&lt;\/groupId&gt;\n            &lt;artifactId&gt;core&lt;\/artifactId&gt;\n            &lt;version&gt;1.0.21&lt;\/version&gt;\n        &lt;\/dependency&gt;\n    &lt;\/dependencies&gt;\n&lt;\/project&gt;\n<\/pre>\n<p>Here we have:<\/p>\n<ul class=\"wp-block-list\">\n<li>The standard groupId\/artifactId\/version definition for our project<\/li>\n<li>The single dependency on the HttpMate core library<\/li>\n<\/ul>\n<p>This is enough to start developing our endpoint in the IDE of choice. Most of those have support for Maven based Java projects.<\/p>\n<h2 class=\"wp-block-heading\">Application Entrypoint<\/h2>\n<p>To start our little server, we will use a simple main method. Let&#8217;s create the entry to our application as an&nbsp;<code>Application.java<\/code>&nbsp;file in the directory&nbsp;<code>src\/main\/java\/com\/envimate\/examples\/http<\/code>&nbsp;that will for now just output the time to the console.<\/p>\n<pre class=\"brush:java\">\npackage com.envimate.examples.http;\n\nimport java.time.LocalDateTime;\nimport java.time.format.DateTimeFormatter;\n\npublic final class Application {\n    public static void main(String[] args) {\n        final LocalDateTime time = LocalDateTime.now();\n        final String dateFormatted = time.format(DateTimeFormatter.ISO_TIME);\n        System.out.println(\"current time is \" + dateFormatted);\n    }\n}\n<\/pre>\n<p>Try to run this class and you will see the current time printed.<\/p>\n<p>Let&#8217;s make this more&nbsp;functional&nbsp;and separate the part that prints out the time into a lambda function with no argument, a.k.a&nbsp;<code>Supplier<\/code>.<\/p>\n<pre class=\"brush:java\">\npackage com.envimate.examples.http;\n\nimport java.time.LocalDateTime;\nimport java.time.format.DateTimeFormatter;\nimport java.util.function.Supplier;\n\npublic final class Application {\n    public static void main(String[] args) {\n        Supplier handler = () -> {\n            final LocalDateTime time = LocalDateTime.now();\n            final String dateFormatted = time.format(DateTimeFormatter.ISO_TIME);\n            return \"current time is \" + dateFormatted;\n        };\n\n        System.out.println(handler.get());\n    }\n}\n<\/pre>\n<p>The convenience interface provided by the low-level HttpMate does not look much different, except instead of returning a&nbsp;<code>String<\/code>, that&nbsp;<code>String<\/code>&nbsp;is set to the response, alongside with the indication that everything went well (a.k.a. response code 200).<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\">\nfinal HttpHandler httpHandler = (request, response) -> {\n    final LocalDateTime time = LocalDateTime.now();\n    final String dateFormatted = time.format(DateTimeFormatter.ISO_TIME);\n\n    response.setStatus(200);\n    response.setBody(\"current time is \" + dateFormatted);\n};\n<\/pre>\n<p>HttpMate also provides a simple Java HttpServer wrapper &#8211;&nbsp;<code>PureJavaEndpoint<\/code>&nbsp;&#8211; that would allow you to start an endpoint without any further dependency.<\/p>\n<p>All we need to do is give it the instance of the HttpMate:<\/p>\n<pre class=\"brush:java\">\npackage com.envimate.examples.http;\n\nimport com.envimate.httpmate.HttpMate;\nimport com.envimate.httpmate.convenience.endpoints.PureJavaEndpoint;\nimport com.envimate.httpmate.convenience.handler.HttpHandler;\n\nimport java.time.LocalDateTime;\nimport java.time.format.DateTimeFormatter;\n\nimport static com.envimate.httpmate.HttpMate.anHttpMateConfiguredAs;\nimport static com.envimate.httpmate.LowLevelBuilder.LOW_LEVEL;\n\npublic final class Application {\n    public static void main(String[] args) {\n        final HttpHandler httpHandler = (request, response) -> {\n            final LocalDateTime time = LocalDateTime.now();\n            final String dateFormatted = time.format(DateTimeFormatter.ISO_TIME);\n\n            response.setStatus(200);\n            response.setBody(\"current time is \" + dateFormatted);\n        };\n\n        final HttpMate httpMate = anHttpMateConfiguredAs(LOW_LEVEL)\n                .get(\"\/time\", httpHandler)\n                .build();\n        PureJavaEndpoint.pureJavaEndpointFor(httpMate).listeningOnThePort(1337);\n    }\n}\n<\/pre>\n<p>Notice that we have configured our httpHandler to serve the path&nbsp;<code>\/time<\/code>, when invoked with method GET.<\/p>\n<p>It&#8217;s time to start our Application and make some requests:<\/p>\n<pre class=\"brush:bash\">\ncurl http:\/\/localhost:1337\/time\ncurrent time is 15:09:34.458756\n<\/pre>\n<p>Before we put this all into a Dockerfile, we need to package it as a good-old jar.<\/p>\n<h2 class=\"wp-block-heading\">Building the Jar<\/h2>\n<p>We&#8217;d need two maven plugins for that:<a target=\"_blank\" rel=\"noreferrer noopener\" href=\"https:\/\/maven.apache.org\/plugins\/maven-compiler-plugin\/\">maven-compiler-plugin<\/a>&nbsp;and<a target=\"_blank\" rel=\"noreferrer noopener\" href=\"http:\/\/maven.apache.org\/plugins\/maven-assembly-plugin\/\">maven-assembly-plugin<\/a>&nbsp;to build the executable jar.<\/p>\n<pre class=\"brush:xml\">\n&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\n&lt;project xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" xmlns=\"http:\/\/maven.apache.org\/POM\/4.0.0\"\n         xsi:schemaLocation=\"http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/maven-v4_0_0.xsd\"&gt;\n    &lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;\n\n    &lt;groupId&gt;com.envimate.examples&lt;\/groupId&gt;\n    &lt;artifactId&gt;simple-java-http-docker&lt;\/artifactId&gt;\n    &lt;version&gt;0.0.1&lt;\/version&gt;\n\n    &lt;dependencies&gt;\n        &lt;dependency&gt;\n            &lt;groupId&gt;com.envimate.httpmate&lt;\/groupId&gt;\n            &lt;artifactId&gt;core&lt;\/artifactId&gt;\n            &lt;version&gt;1.0.21&lt;\/version&gt;\n        &lt;\/dependency&gt;\n    &lt;\/dependencies&gt;\n\n    &lt;build&gt;\n        &lt;plugins&gt;\n            &lt;plugin&gt;\n                &lt;groupId&gt;org.apache.maven.plugins&lt;\/groupId&gt;\n                &lt;artifactId&gt;maven-compiler-plugin&lt;\/artifactId&gt;\n                &lt;version&gt;3.8.1&lt;\/version&gt;\n                &lt;configuration&gt;\n                    &lt;release&gt;${java.version}&lt;\/release&gt;\n                    &lt;source&gt;${java.version}&lt;\/source&gt;\n                    &lt;target&gt;${java.version}&lt;\/target&gt;\n                &lt;\/configuration&gt;\n            &lt;\/plugin&gt;\n            &lt;plugin&gt;\n                &lt;groupId&gt;org.apache.maven.plugins&lt;\/groupId&gt;\n                &lt;artifactId&gt;maven-assembly-plugin&lt;\/artifactId&gt;\n                &lt;executions&gt;\n                    &lt;execution&gt;\n                        &lt;phase&gt;package&lt;\/phase&gt;\n                        &lt;goals&gt;\n                            &lt;goal&gt;single&lt;\/goal&gt;\n                        &lt;\/goals&gt;\n                        &lt;configuration&gt;\n                            &lt;archive&gt;\n                                &lt;manifest&gt;\n                                    &lt;mainClass&gt;\n                                        com.envimate.examples.http.Application\n                                    &lt;\/mainClass&gt;\n                                &lt;\/manifest&gt;\n                            &lt;\/archive&gt;\n                            &lt;descriptorRefs&gt;\n                                &lt;descriptorRef&gt;jar-with-dependencies&lt;\/descriptorRef&gt;\n                            &lt;\/descriptorRefs&gt;\n                        &lt;\/configuration&gt;\n                    &lt;\/execution&gt;\n                &lt;\/executions&gt;\n            &lt;\/plugin&gt;\n        &lt;\/plugins&gt;\n    &lt;\/build&gt;\n&lt;\/project&gt;\n<\/pre>\n<p>Once we have that, let&#8217;s build our jar: <\/p>\n<pre class=\"brush:bash\">\nmvn clean verify\n<\/pre>\n<p>And run the resulting jar: <\/p>\n<pre class=\"brush:bash\">\njava -jar target\/simple-java-http-docker-0.0.1-jar-with-dependencies.jar\n<\/pre>\n<p>Same curl: <\/p>\n<pre class=\"brush:bash\">\ncurl http:\/\/localhost:1337\/time\ncurrent time is 15:14:42.992563\n<\/pre>\n<h2 class=\"wp-block-heading\">Dockerizing the Jar<\/h2>\n<p>The Dockerfile looks quite simple:<\/p>\n<pre class=\"brush:sql\">\nFROM openjdk:12\n\nADD target\/simple-java-http-docker-0.0.1-jar-with-dependencies.jar \/opt\/application.jar\n\nEXPOSE 1337\n\nENTRYPOINT exec java -jar \/opt\/application.jar\n<\/pre>\n<p>It specifies<\/p>\n<ul class=\"wp-block-list\">\n<li><code>FROM<\/code>: which image to use as a base. We will use an openjdk image.<\/li>\n<li><code>ADD<\/code>: the jar we want to the directory we want<\/li>\n<li><code>EXPOSE<\/code>: the port we are listening on<\/li>\n<li><code>ENTRYPOINT<\/code>: to the command, we want to execute<\/li>\n<\/ul>\n<p>To build and tag our docker image, we run the following command from the root of the directory:<\/p>\n<pre class=\"brush:bash\">\ndocker build --tag simple-java-http-docker .\n<\/pre>\n<p>This will produce a docker image that we can run: <\/p>\n<pre class=\"brush:bash\">\ndocker run --publish 1337:1337 simple-java-http-docker\n<\/pre>\n<p>Notice that we are passing the&nbsp;<code>--publish<\/code>&nbsp;parameter, which indicates that the exposed 1337 port, is available under the 1337 port of the machine.<\/p>\n<p>Same curl:<\/p>\n<pre class=\"brush:bash\">\ncurl http:\/\/localhost:1337\/time\ncurrent time is 15:23:04.275515\n<\/pre>\n<p> And that is it: we have our simple HTTP endpoint dockerized! <\/p>\n<h2 class=\"wp-block-heading\">The Icing<\/h2>\n<p>Of course, this is a simplified example, and the endpoint we wrote is not entirely useful. It demonstrates though that you don&#8217;t need tons of libraries just to have a running HTTP endpoint, how easy it is to package a runnable jar, use docker with your java application and the basic usage of the low-level HttpMate.<\/p>\n<p>This kind of two-minute setup can be handy when you need to quickly spin a test HTTP server. The other day I was working on a Twitter-bot (stay tuned for an article about that) and I had to debug what my request really looks like on the receiving side. Obviously, I couldn&#8217;t ask Twitter to give me a dump of my request, so I needed a simple endpoint, that would output everything possible about my request.<\/p>\n<p>HttpMate&#8217;s handler provides access to an object called&nbsp;<code>MetaData<\/code>&nbsp;which is pretty much what it&#8217;s called &#8211; the meta-data of your request, meaning everything available about your request.<\/p>\n<p>Using that object, we can print everything there is to the request.<\/p>\n<pre class=\"brush:java\">\npublic final class FakeTwitter {\n    public static void main(String[] args) {\n        final HttpMate httpMate = HttpMate.aLowLevelHttpMate()\n                .callingTheHandler(metaData -> {\n                    System.out.println(metaData);\n                })\n                .forRequestPath(\"\/*\").andRequestMethods(GET, POST, PUT)\n                .build();\n\n        PureJavaEndpoint.pureJavaEndpointFor(httpMate).listeningOnThePort(1337);\n    }\n}\n<\/pre>\n<p>The request path&nbsp;<code>\/time<\/code>&nbsp;is now replaced with a pattern, capturing all paths, and we can add all the HTTP methods we are interested in.<\/p>\n<p>Running our FakeTwitter server and issuing request:<\/p>\n<pre class=\"brush:bash\">\ncurl -XGET http:\/\/localhost:1337\/some\/path\/with?someParameter=someValue\n<\/pre>\n<p>We&#8217;ll see the following output in the console (output formatted for readability: it is a map underneath, so you can format it nicely if you so wish)<\/p>\n<pre class=\"brush:bash\">\n{\n    PATH=Path(path=\/some\/path\/with),\n    BODY_STRING=,\n    RAW_QUERY_PARAMETERS={someParameter=someValue},\n    QUERY_PARAMETERS=QueryParameters(\n        queryParameters={\n            QueryParameterKey(key=someParameter)=QueryParameterValue(value=someValue)\n        }\n    ),\n    RESPONSE_STATUS=200,\n    RAW_HEADERS={Accept=*\/*,\n    Host=localhost:1337,\n    User-agent=curl\/7.61.0},\n    RAW_METHOD=GET,\n    IS_HTTP_REQUEST=true,\n    PATH_PARAMETERS=PathParameters(pathParameters={}),\n    BODY_STREAM=sun.net.httpserver.FixedLengthInputStream@6053cef4,\n    RESPONSE_HEADERS={},\n    HEADERS=Headers(headers={HeaderKey(value=user-agent)=HeaderValue(value=curl\/7.61.0),\n    HeaderKey(value=host)=HeaderValue(value=localhost:1337),\n    HeaderKey(value=accept)=HeaderValue(value=*\/*)}),\n    CONTENT_TYPE=ContentType(value=null),\n    RAW_PATH=\/some\/path\/with,\n    METHOD=GET,\n    LOGGER=com.envimate.httpmate.logger.Loggers$$Lambda$17\/0x000000080118f040@5106c12f,\n    HANDLER=com.envimate.examples.http.FakeTwitter$$Lambda$18\/0x000000080118f440@68157191\n}\n<\/pre>\n<h2 class=\"wp-block-heading\">Final Words<\/h2>\n<p>HttpMate on its own offers much more functionality. However, it is young, is not yet for production use and needs your support! If you like what you read, let us know, by dropping us an email to opensource@envimate.com, or just by trying out HttpMate and leaving a comment in the <a rel=\"noreferrer noopener\" target=\"_blank\" href=\"https:\/\/github.com\/envimate\/httpmate\/issues\/3\">feedback issue<\/a>.<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td>Published on Java Code Geeks with permission by Envimate, partner at our <a target=\"_blank\" href=\"\/\/www.javacodegeeks.com\/join-us\/jcg\/\" rel=\"noopener noreferrer\">JCG program<\/a>. See the original article here: <a target=\"_blank\" href=\"https:\/\/blog.envimate.com\/java-http-single-dependency-in-docker\" rel=\"noopener noreferrer\">Java Single Dependency Dockerized HTTP Endpoint<\/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>In this article, we will create a Java-based HTTP endpoint, make an executable jar out of it, pack it up in Docker and run it locally in no time. This article is intended for beginners, who want to looking for a simple walk-through for running a Java application in Docker. The vast majority of examples &hellip;<\/p>\n","protected":false},"author":96356,"featured_media":24013,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[936],"class_list":["post-94575","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-docker"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Java Single Dependency Dockerized - Java Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"Interested to learn more? Then check out our detailed example on Java Single Dependency Dockerized HTTP Endpoint!We will create a Java-based HTTP endpoint.\" \/>\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\/08\/java-single-dependency-dockerized-http-endpoint.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java Single Dependency Dockerized - Java Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"Interested to learn more? Then check out our detailed example on Java Single Dependency Dockerized HTTP Endpoint!We will create a Java-based HTTP endpoint.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2019\/08\/java-single-dependency-dockerized-http-endpoint.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-08-05T04:00:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/04\/docker-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=\"Envimate\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@envimate\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Envimate\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/08\\\/java-single-dependency-dockerized-http-endpoint.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/08\\\/java-single-dependency-dockerized-http-endpoint.html\"},\"author\":{\"name\":\"Envimate\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/5681b97471a3a4f2c9a7ef8ac7061def\"},\"headline\":\"Java Single Dependency Dockerized HTTP Endpoint\",\"datePublished\":\"2019-08-05T04:00:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/08\\\/java-single-dependency-dockerized-http-endpoint.html\"},\"wordCount\":907,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/08\\\/java-single-dependency-dockerized-http-endpoint.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2014\\\/04\\\/docker-logo.jpg\",\"keywords\":[\"Docker\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/08\\\/java-single-dependency-dockerized-http-endpoint.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/08\\\/java-single-dependency-dockerized-http-endpoint.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/08\\\/java-single-dependency-dockerized-http-endpoint.html\",\"name\":\"Java Single Dependency Dockerized - Java Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/08\\\/java-single-dependency-dockerized-http-endpoint.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/08\\\/java-single-dependency-dockerized-http-endpoint.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2014\\\/04\\\/docker-logo.jpg\",\"datePublished\":\"2019-08-05T04:00:19+00:00\",\"description\":\"Interested to learn more? Then check out our detailed example on Java Single Dependency Dockerized HTTP Endpoint!We will create a Java-based HTTP endpoint.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/08\\\/java-single-dependency-dockerized-http-endpoint.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/08\\\/java-single-dependency-dockerized-http-endpoint.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/08\\\/java-single-dependency-dockerized-http-endpoint.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2014\\\/04\\\/docker-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2014\\\/04\\\/docker-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/08\\\/java-single-dependency-dockerized-http-endpoint.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\":\"Java Single Dependency Dockerized HTTP Endpoint\"}]},{\"@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\\\/5681b97471a3a4f2c9a7ef8ac7061def\",\"name\":\"Envimate\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/56a5fcdb456b9e8790d2ec116238e679ea675a6828e252cef2ca7cef706c3c41?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/56a5fcdb456b9e8790d2ec116238e679ea675a6828e252cef2ca7cef706c3c41?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/56a5fcdb456b9e8790d2ec116238e679ea675a6828e252cef2ca7cef706c3c41?s=96&d=mm&r=g\",\"caption\":\"Envimate\"},\"description\":\"Envimate is a consulting and software engineering company that provides teams with additional brainpower and capacity in areas of DevOps, CI\\\/CD, AWS, Java\\\/Golang Development, Architecture and Clean Code, while also providing the community with opensource projects and increasing the exposure to best practices of software engineering\",\"sameAs\":[\"https:\\\/\\\/blog.envimate.com\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/envimate-gmbh\",\"https:\\\/\\\/x.com\\\/envimate\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/envimate\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Java Single Dependency Dockerized - Java Code Geeks - 2026","description":"Interested to learn more? Then check out our detailed example on Java Single Dependency Dockerized HTTP Endpoint!We will create a Java-based HTTP endpoint.","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\/08\/java-single-dependency-dockerized-http-endpoint.html","og_locale":"en_US","og_type":"article","og_title":"Java Single Dependency Dockerized - Java Code Geeks - 2026","og_description":"Interested to learn more? Then check out our detailed example on Java Single Dependency Dockerized HTTP Endpoint!We will create a Java-based HTTP endpoint.","og_url":"https:\/\/www.javacodegeeks.com\/2019\/08\/java-single-dependency-dockerized-http-endpoint.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2019-08-05T04:00:19+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/04\/docker-logo.jpg","type":"image\/jpeg"}],"author":"Envimate","twitter_card":"summary_large_image","twitter_creator":"@envimate","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Envimate","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2019\/08\/java-single-dependency-dockerized-http-endpoint.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/08\/java-single-dependency-dockerized-http-endpoint.html"},"author":{"name":"Envimate","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/5681b97471a3a4f2c9a7ef8ac7061def"},"headline":"Java Single Dependency Dockerized HTTP Endpoint","datePublished":"2019-08-05T04:00:19+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/08\/java-single-dependency-dockerized-http-endpoint.html"},"wordCount":907,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/08\/java-single-dependency-dockerized-http-endpoint.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/04\/docker-logo.jpg","keywords":["Docker"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2019\/08\/java-single-dependency-dockerized-http-endpoint.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2019\/08\/java-single-dependency-dockerized-http-endpoint.html","url":"https:\/\/www.javacodegeeks.com\/2019\/08\/java-single-dependency-dockerized-http-endpoint.html","name":"Java Single Dependency Dockerized - Java Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/08\/java-single-dependency-dockerized-http-endpoint.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/08\/java-single-dependency-dockerized-http-endpoint.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/04\/docker-logo.jpg","datePublished":"2019-08-05T04:00:19+00:00","description":"Interested to learn more? Then check out our detailed example on Java Single Dependency Dockerized HTTP Endpoint!We will create a Java-based HTTP endpoint.","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/08\/java-single-dependency-dockerized-http-endpoint.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2019\/08\/java-single-dependency-dockerized-http-endpoint.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2019\/08\/java-single-dependency-dockerized-http-endpoint.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/04\/docker-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/04\/docker-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2019\/08\/java-single-dependency-dockerized-http-endpoint.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":"Java Single Dependency Dockerized HTTP Endpoint"}]},{"@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\/5681b97471a3a4f2c9a7ef8ac7061def","name":"Envimate","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/56a5fcdb456b9e8790d2ec116238e679ea675a6828e252cef2ca7cef706c3c41?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/56a5fcdb456b9e8790d2ec116238e679ea675a6828e252cef2ca7cef706c3c41?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/56a5fcdb456b9e8790d2ec116238e679ea675a6828e252cef2ca7cef706c3c41?s=96&d=mm&r=g","caption":"Envimate"},"description":"Envimate is a consulting and software engineering company that provides teams with additional brainpower and capacity in areas of DevOps, CI\/CD, AWS, Java\/Golang Development, Architecture and Clean Code, while also providing the community with opensource projects and increasing the exposure to best practices of software engineering","sameAs":["https:\/\/blog.envimate.com\/","https:\/\/www.linkedin.com\/company\/envimate-gmbh","https:\/\/x.com\/envimate"],"url":"https:\/\/www.javacodegeeks.com\/author\/envimate"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/94575","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\/96356"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=94575"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/94575\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/24013"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=94575"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=94575"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=94575"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}