This project serves as a basic start point for our Spring core training. It provides a basic setup containing an embedded Tomcat and a basic REST controller to check if it works. So with this participants should be able to start hacking right away.
To run this example project you need Java 11+ installed properly. We suggest to use SDKMAN for this.
This repository contains a basic Gradle project. It should be able to just import it into the IDE of choice and start adding new stuff.
-
Start the application using gradle:
./gradlew run
-
Check if the provided health endpoint is responding:
curl http://localhost:8080/health
This should return:
{"status":"up"}
- Embedded Tomcat The project was setup to provide you with an embedded Tomcat so no need to deploy your own. The Tomcat is started as part of a normal Java "main" method.
- Spring's DispatcherServlet The project also already provides a DispatcherServlet so REST controller can be reached via HTTP.
- Basic /health endpoint The project also contains a first Spring MVC REST controller that is exposing an health endpoint. This is mainly done to help you check if the setup is working at all so you can more easily find errors.
Make sure you have installed Docker Compose. The database can be started as a Docker container as follows:
docker-compose up -d