This project serves as an example of a Spring Boot RESTful application, which represents a simple store can contain products and orders.
It contains two API:
- A product API were the user can add and update products.
- A order API were the user can use the products to create orders, with parcels.
The application can be started using the following gradle task:
./gradlew clean bootRun
Also are also the available tasks:
- ./gradlew clean - clean the project folder
- ./gradlew build - build the project and the corresponding tests
- ./gradlew asciidoctor - use the test snippet results to generate the documentation
The application can be started by just running the main class:
com.myprojects.spring.productstore.StoreApplication
The last way to start the application is by running the jar file with the following command in the terminal:
java -jar productstore-0.0.1.jar
The backend application is configured by default to run under port 8080.
This can be reconfigured by setting the property server.port in application.yml file.
There are two main access points for the backend application when it is running locally:
To access the base entry point to product REST api the following link can be use:
localhost:8080/store/products.
To access the base entry point to orders REST api the following link can be use:
localhost:8080/store/orders.
To access the api documentation just open your web browser on:
localhost:8080/docs/api-guide.html
Please note that this only works when starting the packaged:
- Using the spring boot jar generated.
- Using the spring boot runner (./gradlew bootRun)
It is also possible to read the documentation without starting the application using the following package gradle task:
./gradlew asciidoctor
This task will generate the documentation static files on the project folder build/asciidoc/html5.
This application uses a simples generic h2 memory database for simplicity propose.
To access the UI of it just open your web browser on:
localhost:8080/console
The configuration used to access should be the following:
Driver Class: org.h2.Driver
JDBC URL: jdbc:h2:mem:store
User Name: sa
Password:
No monitoring access point were included.
TODO