This tutorial uses the information found in the Serving Web Content with Spring MVC tutorial and Building a RESTful Web Service tutorial.
If you're interesting in learning the Spring Framework in greater detail, checkout the guides found here and read about the core concepts here.
- Clone the repository:
git clone https://github.com/alexmancheno/Spring-Boot-Demo.git
- Change into the root of the application:
cd Spring-Boot-Demo
- Run the application using Maven:
mvn spring-boot:run
- Test your app by visiting the home page of the app:
http://localhost:8080
- Test the RESTful controller that returns JSON:
http://localhost:8080/greeting?name=John&major=ComputerScience
Note: if you don't have Maven installed, use the Maven wrapper instead. Example:
./mvnw
If you need to grant permissions on Mac for the Maven wrapper:
chmod a+x mvnw
- Create the JAR using Maven:
mvn clean package
- Run the JAR file:
java -jar target/demo-0.0.1-SNAPSHOT.jar