User Story: Carlos from Mexico City
C Carlos has been following our predictions for over six months and has seen significant improvements in his betting outcomes. By diversifying his bets based on our detailed analyses, he was able to increase his winnings by over 30% compared to the previous year.
<|repo_name|>damianholst/wildfly-swarm<|file_sep|>/docs/src/main/asciidoc/_variables.adoc
:project-name: WildFly Swarm
:project-version: {swarm-version}
:project-group-id: org.wildfly.swarm
:wildfly-version: {wildfly-version}
:wildfly-home:
:jboss-home:
:wildfly-swarm-dist:
:wildfly-swarm-dist-plain:
:wildfly-swarm-jaxrs-dist:
:jboss-modules-path:
:jboss-modules-remote-path:
:jboss-modules-local-path:
:jboss-modules-local-remote-path:
:wildfly-home-path:
:jboss-home-path:
:wildfly-swarm-dist-path:
:wildfly-swarm-dist-plain-path:
:jboss-modules-path-plain:
:jboss-modules-remote-path-plain:
:jboss-modules-local-path-plain:
:jboss-modules-local-remote-path-plain:
:wildfly-home-url:
:jboss-home-url:
:wildfly-swarm-dist-url:
:wildfly-swarm-jaxrs-dist-url:
// Set the following variables before compiling the book
// http://asciidoctor.org/docs/user-manual/#attributes
ifdef::env-github[]
:tip-caption: :bulb:
:note-caption: :information_source:
endif::[]
ifndef::env-github[]
ifdef::backend-html5[]
// Set the following variables before compiling the book
// http://asciidoctor.org/docs/user-manual/#attributes
// This will allow the image tags to work properly in both HTML and PDF.
ifdef::imagesdir[:imagesdir: {imagesdir}]
endif::[]
endif::[]
endif::[]
// Link to the latest released version on GitHub
ifdef::env-github[]
:wildfly-swarm-version-link:{project-version}[{project-version}]
endif::[]
ifndef::env-github[]
// Link to the latest released version on GitHub
// :wildfly-swarm-version-link:{project-version}[{project-version}]
// Version is set from environment variable WILDFLY_SWARM_VERSION.
:wildfly-swarm-version-link:{swarm-version}[{swarm-version}]
endif::[]
ifdef::env-github[]
:sbt-plugin-link:{sbt-plugin-repo}[sbt plugin]
endif::[]
ifndef::env-github[]
:sbt-plugin-link:{sbt-plugin-repo}[https://github.com/wildfly-swarm/wildfly-swarm-sbt-plugin]
endif::[]
ifdef::env-github[]
:maven-plugin-link:{maven-plugin-repo}[maven plugin]
endif::[]
ifndef::env-github[]
:maven-plugin-link:{maven-plugin-repo}[https://github.com/wildfly-swarm/wildfly-swarm-maven-plugin]
endif::[]
:spring-boot-link:http://projects.spring.io/spring-boot/[Spring Boot]
:spring-boot-maven-plugin-link:http://docs.spring.io/spring-boot/docs/current/reference/html/build-tool-plugins-maven-plugin.html[Spring Boot Maven Plugin]
:spring-boot-starter-web-link:http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#getting-started-first-application-web[maven dependency]
:spring-boot-starter-test-link:http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-testing[starter test dependency]
:spring-boot-appdev-mvn-cmd-line-run:[mvn spring-boot:run]
:spring-boot-appdev-mvn-cmd-line-package:[mvn package]
:spring-boot-appdev-jar-file-name:[target/*.jar]
// https://www.scala-sbt.org/0.13/docs/Commands.html#test%20(Tests)
:sbt-test-command:[sbt test]
// https://github.com/wvlet/airframe/blob/master/README.md#airframe-module-generator
:microprofile-config-generator:[airframe-gen]
// https://github.com/Netflix/eureka/wiki/Eureka-at-a-glance
:eureka-at-a-glance:[Eureka at a glance]
// https://github.com/eclipse/microprofile-config/tree/master/microprofile-config-tck#tcktestcases
:microprofile-config-tck-test-cases:[MicroProfile Config TCK Test Cases]
// https://dzone.com/articles/java-websockets-in-action-with-wildfly-and-spring-boot
:dzone-java-websockets-in-action-with-wildfly-and-spring-boot:[Java WebSockets in Action with WildFly and Spring Boot]
// https://www.redhat.com/en/blog/how-to-deploy-your-first-restful-service-using-wildfly-swarm
:redhat-how-to-deploy-your-first-restful-service-using-wildfly-swarm:[How to Deploy Your First RESTful Service Using WildFly Swarm]
// https://www.redhat.com/en/blog/how-to-build-simple-java-rest-service-using-wildfly-swarm-and-spring-boot
:redhat-how-to-build-simple-java-rest-service-using-wildfly-swarm-and-spring-boot:[How to Build Simple Java REST Service Using WildFly Swarm and Spring Boot]
// https://www.redhat.com/en/blog/deploying-a-microservice-using-wildfly-swarm-and-docker
:redhat-deploying-a-microservice-using-wildfly-swarm-and-docker:[Deploying A Microservice Using WildFly Swarm and Docker]
// https://www.redhat.com/en/blog/introduction-easy-dockerized-java-applications-using-wildfly-swarm-docker-compose-and-docker-machine
:redhat-introduction-easy-dockerized-java-applications-using-wildfly-swarm-docker-compose-and-docker-machine:[Introduction to Easy Dockerized Java Applications Using WildFly Swarm Docker Compose and Docker Machine]
// https://github.com/jeffmaurer/swagger-springmvc-sample/blob/master/README.md
:dzone-introduction-to-the-open-api-specification-and-the-spring-framework[An Introduction to the OpenAPI Specification and the Spring Framework]
// https://wildscribe.wordpress.com/2016/02/18/persistent-storage-in-kubernetes/
:wildscribe-persistent-storage-in-kubernetes:[Persistent Storage in Kubernetes]
<|file_sep|>= How To Deploy Your First RESTful Service Using WildFly Swarm
== Introduction
This guide will show you how to use WildFly Swarm to create and deploy your first RESTful service using JAX-RS.
WildFly Swarm provides an embedded container which enables you to create and deploy stand-alone microservices easily.
The idea is that you will develop your microservices without having to run an external container such as WildFly or Tomcat.
Once you are happy with your code you can then package it up as an executable jar file which includes all of the dependencies required by your application.
You can then deploy this jar file into an external container if required or use it standalone without any external dependencies.
== Creating your first RESTful service
The first thing we need to do is create a new project which will hold our RESTful service.
We will be using Apache Maven as our build tool so we will create our project using the Maven archetype command.
This command creates all of the files that we need for our project and adds them into their respective directories.
Create your project directory and then execute the following command within it:
[source,bash]
----
$ mvn archetype:create -DgroupId=com.redhat.examples -DartifactId=hello-world -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false
----
Once this has finished executing you should see something like this:
[source,bash]
----
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM)
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-archetype-plugin:3.0.1:create (default-cli) @ standalone-pom ---
[INFO] Generating project in Batch mode
....
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: maven-archetype-webapp:1.4
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: com.redhat.examples
[INFO] Parameter: artifactId, Value: hello-world
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value