Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/akaliutau/spring-boot-3-reference-design
Spring Boot 3 Reference Design project
https://github.com/akaliutau/spring-boot-3-reference-design
java17 java17-spring-boot lombok openapi reference-designs spring-boot
Last synced: 6 days ago
JSON representation
Spring Boot 3 Reference Design project
- Host: GitHub
- URL: https://github.com/akaliutau/spring-boot-3-reference-design
- Owner: akaliutau
- License: apache-2.0
- Created: 2023-11-15T15:13:15.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-20T13:44:02.000Z (about 1 year ago)
- Last Synced: 2024-11-12T04:27:12.263Z (2 months ago)
- Topics: java17, java17-spring-boot, lombok, openapi, reference-designs, spring-boot
- Language: Java
- Homepage:
- Size: 63.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Reference design: Spring Boot 3 CRUD service
This is a reference design to build microservices (CRUD service) on the basis of Java17, Spring Boot 3 and H2 database
## Building and running a service:
```shell
mvn clean install
mvn spring-boot:run
```## Testing
The last command will start server at `localhost:8080`. The in-memory database H2 is populated with a couple of records, so one can test service in action.
To test endpoints, go to `http://localhost:8080/swagger-ui/index.html` - this url points to Swagger page with generated API
Go to `POST /login` endpoint down the page and authorize yourself with user/pwd pair `admin:admin`. This will give you the bearer token, use it to authorize Swagger to invoke other endpoints on behalf of you.
After that one can invoke any endpoints, for example `GET /api/cars` will return json like this:
```json
{
"_embedded": {
"cars": [
{
"brand": "Ford",
"model": "Mustang",
"color": "Red",
"registrationNumber": "ADF-1121",
"modelYear": 2023,
"price": 59000,
"_links": {
"self": {
"href": "http://localhost:8080/api/cars/1"
},
"car": {
"href": "http://localhost:8080/api/cars/1"
},
"owner": {
"href": "http://localhost:8080/api/cars/1/owner"
}
}
},```
Note the auto-generated fields `_links` - they are created due to presence of data-rest dependency on class path which enriches the output to match HATEOS(Hypertext as the Engine of Application State) principles.