Sample Configuration Service using Spring Boot.
You have two choice for installation: either build the project and run it using Tomcat or run it using Docker. One way to accomplish the former is to install an IDE like Eclipse with Tomcat pre-installed.
For the latter download and install Docker and the use the following instructions. This is the fastest way and also the one I recommend to get the project up and running in no time.
- Checkout or download the project
- Use your terminal to go into the folder you downloaded the project.
- Build and start the container by running:
$ docker-compose up --build
$ curl localhost:8080/
$ docker-compose down
- POST localhost:8080/foo with body {"name": "Foo", "value": "val0"} to add a new configuration "foo"
- GET localhost:8080/foo to retrieve configuration "foo"
- PUT localhost:8080/foo with body {"name": "Foo", "value": "val1"} to update configuration "foo"
- GET localhost:8080/ to retrieve all the available configurations
- DELETE localhost:8080/foo to delete the configuration "foo"
The project has been entirely built using Java and Spring Boot.
- Controllers are in charge of handling the REST requests.
- Services handle the logic.
All the tests are in the test package. Any new functionality added (see below section) should continue following this structure. For the sake of this sample project the whole data structure is saved in-memory. If you need to persist your data for more then a single session I suggest attaching a DB and changing the ConfigurationService class to persist the configuration data, instead of simply saving it in memory.
Feel free to add your contributions to the project.
- Fork the project
- Create a new branch
- Add your contribution
- Push your branch
- Submit a pull request