Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mwarman/spring-boot-playground-2
A playground project for a Spring Boot 2.x RESTful API application component.
https://github.com/mwarman/spring-boot-playground-2
java openapi3 spring-boot
Last synced: about 2 months ago
JSON representation
A playground project for a Spring Boot 2.x RESTful API application component.
- Host: GitHub
- URL: https://github.com/mwarman/spring-boot-playground-2
- Owner: mwarman
- Created: 2023-11-21T13:17:43.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-05T11:17:20.000Z (about 1 year ago)
- Last Synced: 2024-04-17T01:04:28.697Z (9 months ago)
- Topics: java, openapi3, spring-boot
- Language: Java
- Homepage:
- Size: 68.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Spring Boot Playground (2.x)
A Spring Boot playground project for Spring Boot 2.x
## How to use
### Prerequisites
This project requires Java 8 or later. It has been tested with Java 8 specifically to ensure compatibility, but should work with later versions.
### Run the application locally
Issue the following command in the project base directory to run the application locally.
```sh
./gradlew bootRun
```The application starts, printing the log to the terminal console. The application may be accessed on base URL http://localhost:8080.
To stop the application, press `ctrl-C` (or `cmd-C` on a Mac).
### Package the application deployment
Issue the following command in the project base directory to package the application as an executable Jar.
```sh
./gradlew clean bootJar
```The application is packaged as an executable Jar file, suitable for deployment to hosted environments. The Jar file is located in `./build/libs`, for example `./build/libs/demo-0.0.1-SNAPSHOT.jar`.
The Jar may be executed with a command like `java -jar demo-0.0.1-SNAPSHOT.jar`.
### Testing
#### Endpoints
The application exposes a set of demonstration RESTful API endpoints which simulate standard CRUD operations on a `Todo` entity. The API endpoints are:
- `POST /api/todos` - Create a Todo
- `GET /api/todos` - List all Todos
- `GET /api/todos/{id}` - Get a single Todo by `id`
- `PUT /api/todos/{id}` - Update a Todo
- `DELETE /api/todos/{id}` - Delete a TodoIt is recommended that you use an API client such as Postman to exercise these endpoints. With Postman, you may import the OpenAPI specification (see below) rather than creating the endpoints manually.
#### API Docs
The application uses SpringDoc to generate both an interactive UI and an OpenAPI 3 specification.
The URL for the UI is: http://localhost:8080/api-docs/swagger-ui/index.html
The URL for the OpenAPI specification is: http://localhost:8080/api-docs
Adjust the base URL as needed when accessing the UI in hosted environments.
## See Also
For further reference, please consider the following sections:* [Official Gradle documentation](https://docs.gradle.org)
* [Spring Boot Gradle Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.7.17/gradle-plugin/reference/html/)
* [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.7.17/gradle-plugin/reference/html/#build-image)
* [SpringDoc OpenAPI v1](https://springdoc.org/v1/)These additional references should also help you:
* [Gradle Build Scans – insights for your project's build](https://scans.gradle.com#gradle)