Developed by Uladzimir Petranouski
This is sample 'Motor depot' web application.
- Programming Language: Java
- Core Framework: Spring boot
-
- Data Access:
- Spring JDBC
- Spring Data MongoDB
- Build System: Maven
- Control System: Git
- License: Apache license, version 2.0
- Automated Testing:
- Log: Log4j 2
- Database:
- Temporary memory:
- API documentation generation:
- Code generation:
- Template Engine: Thymeleaf
- CSS Framework: Bootstrap
- JDK 11+
- Git 2.25.1+
- Apache Maven 3.6.3+
$ git clone https://github.com/Brest-Java-Course-2021-2/Vladimir-Petranovski-MD-SpringBoot
$ cd Vladimir-Petranovski-MD-SpringBoot
Run for production:
$ mvn clean install -Dspring.profiles.active=prod
Run for testing:
$ mvn clean install -Dspring.profiles.active=test
Run for developing:
$ mvn clean install -Dspring.profiles.active=dev
$ mvn clean test
$ mvn clean verify
Setup rest-app in application.properties:
Profile | Description |
---|---|
dev | Run application with PostgresSQL database |
test | Run application with embedded H2 database in memory |
prod | Run application with MySQL database |
Example:
spring.profiles.active=dev
In the root directory of the project:
$ java -jar -Dspring.profiles.active=dev rest-app/target/rest-app-1.0-SNAPSHOT.jar
The rest application will be accessible at http://localhost:8088. The swagger ui will be accessible at http://localhost:8088.
In the root directory of the project:
$ java -jar -Dspring.profiles.active=dev web-app/target/web-app-1.0-SNAPSHOT.jar
The web application will be accessible at http://localhost:8080.
$ curl --request GET 'http://localhost:8088/version'
$ curl --request GET 'http://localhost:8088/drivers_dto'
$ curl --request GET 'http://localhost:8088/drivers_dto' | json_pp
$ curl --request GET 'http://localhost:8088/drivers' | json_pp
$ curl --request GET 'http://localhost:8088/drivers/1' | json_pp
$ curl --request POST 'http://localhost:8088/drivers' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"driverName": "TOLIA",
"driverDateStartWork": 1214677490.532700000,
"driverSalary": 980
}'
$ curl --request PATCH 'http://localhost:8088/drivers/3' \
--header 'Content-Type: application/json' \
--data-raw '{
"driverName": "SERGEI",
"driverDateStartWork": 1014677990.532700000,
"driverSalary": 470
}'
$ curl --request DELETE 'http://localhost:8088/drivers/3'
$ curl --request GET 'http://localhost:8088/cars' | json_pp
$ curl --request GET 'http://localhost:8088/cars/1' | json_pp
$ curl --request POST 'http://localhost:8088/cars' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"carModel": "GIGULI",
"driverId": 2
}'
$ curl --request PATCH 'http://localhost:8088/cars/3' \
--header 'Content-Type: application/json' \
--data-raw '{
"carModel": "AUDI",
"driverId": 1
}'
$ curl --request DELETE 'http://localhost:8088/cars/3'