Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kasramp/spring-data-redis-example-kotlin
Spring Data Redis with Kotlin
https://github.com/kasramp/spring-data-redis-example-kotlin
kotlin kotlin-language redis spring spring-boot spring-data
Last synced: 18 days ago
JSON representation
Spring Data Redis with Kotlin
- Host: GitHub
- URL: https://github.com/kasramp/spring-data-redis-example-kotlin
- Owner: kasramp
- License: gpl-3.0
- Created: 2019-07-05T20:43:21.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-01-02T20:52:45.000Z (11 months ago)
- Last Synced: 2024-10-14T17:07:50.793Z (about 1 month ago)
- Topics: kotlin, kotlin-language, redis, spring, spring-boot, spring-data
- Language: Kotlin
- Homepage: https://www.geekyhacker.com/getting-started-with-spring-data-redis-with-kotlin/
- Size: 105 KB
- Stars: 26
- Watchers: 2
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Spring Data Redis Example with Kotlin
## Introduction
This example shows how to use Spring Data with Redis to do CRUD operations. Additionally, it demonstrates using Redis as a message broker.
The code is implemented using Kotlin, but it's easy for Java developers to understand as well.
For more in-depth details, have a look at the tutorials at links below:
- [Getting started with Spring Data Redis with Kotlin](https://www.geekyhacker.com/getting-started-with-spring-data-redis-with-kotlin/)
- [Redis Pub/Sub with Spring Boot](https://www.geekyhacker.com/redis-pub-sub-with-spring-boot/)
- [Server-Sent Events with Spring MVC SseEmitter](https://www.geekyhacker.com/server-sent-events-with-spring-mvc-sseemitter/)
- [Distributed SSE with Spring SseEmitter and Redis Pub/Sub](https://www.geekyhacker.com/distributed-sse-with-spring-sseemitter-and-redis-pub-sub/)
- [How to handle MethodArgumentNotValidException in Spring Boot](https://www.geekyhacker.com/how-to-handle-methodargumentnotvalidexception-in-spring-boot/)
- [Spring Boot Redis integration test with Testcontainers in Kotlin](https://www.geekyhacker.com/spring-boot-redis-integration-test-with-testcontainers-in-kotlin/)
- [Spring Boot Swagger documentation using OpenAPI](https://www.geekyhacker.com/spring-boot-swagger-documentation-using-openapi/)
- [Build Docker images in Spring Boot 3](https://www.geekyhacker.com/build-docker-images-in-spring-boot-3/)## Endpoints
To demonstrate CRUD operations, I use `Movie`, `Actor` model and created some endpoints to do basic CRUD operations as follows:
- Create Movie
- Update Movie
- Delete Movie
- List Movies
- Create Actor
- Update Actor
- Delete Actor
- List Actors
- Add an Actor to a Movie
## How to runThe project needs Redis to run. There's a `docker-compose` file contains all necessary configuration to run Redis flawlessly.
To use it. Just run:
```bash
$ docker-compose -f docker-compose.yml up -d
```After that the Redis should be accessible via port `6379` on `localhost`
Then you can run the application like below:
```bash
$ ./mvnw spring-boot:run -Dserver.port=8090
```If you have a Redis running in another port or host, simply override below environment variables:
- `SPRING_REDIS_HOST`
- `SPRING_REDIS_PORT`Or modify `application.properties` file.
To interact with the APIs, after running the project, just open [http://localhost:8080/swagger-ui/index.html](http://localhost:8080/swagger-ui/index.html). You should see Swagger to interact with.