Sample service that uses Spring Native
with Kotlin Coroutines
and Kotlin.
Generate a native image to improve the start-up time.
Find more Spring Native samples here
- Interacting with Reactive Redis API with Kotlin Coroutines. Check the blog
- Kotlin Coroutines
- Kotlin Serialization
- Global Exception Handler
- Input Validation
- Spring Data Redis Repositories CRUD API
- Redis Hash
- Redis Search
- Redis Graph
- Observability
# To generate your own metadata using the annotation processor.
gradle :services:entity:kaptKotlin
# start local redis
gradle redisComposeUp
# stop local redis before restart again
gradle redisComposeDown
# copy container logs to `build/containers-logs`
gradle redisComposeLogs
via docker-compose
# start local redis and grafana
docker compose -f infra/redis.yml up
# (Or) start only redis
docker compose -f infra/redis.yml up redis
# stop local redis before restart again
docker compose -f infra/redis.yml down
# this will stop redis and remove all volumes
docker compose -f infra/redis.yml down -v
Redis Insight: Redis db visualization dashboard
After opening RedisInsight App, connect using host:localhost, port:6379 and name:any_name_is_ok
for Redis Insight 1.x
open http://localhost:8001/
To monitor redis, use Grafana Dashboard
open http://localhost:3000/
gradle :services:entity:bootRun
# log at debug level
gradle :services:entity:bootRun --debug
open http://localhost:8080/account
gradle :services:entity:test
gradle :appservicess:entity:integrationTest
We are using httpie CLI for REST testing
# list
http :8080/account
# health
http :8080/actuator
http :8080/actuator/health
Check API-TEST for more tests.
gradle :services:entity:build
gradle :services:entity:bootBuildImage -x test
Then, you can run the app like any other container:
docker run -i --rm -p 8080:8080 entity-service:1.6.5-SNAPSHOT
Set environment variables in GKE
GOOGLE_CLOUD_PROJECT=my-project-id
GOOGLE_APPLICATION_CREDENTIALS=/path/to/googleCredentials.json
# optional
STACKDRIVER_LOG_NAME
STACKDRIVER_LOG_FLUSH_LEVEL
- https://github.com/rnbWarden/jredisearch-spring-boot-starter
- use Redis Test Container example
testImplementation("com.redislabs.testcontainers:testcontainers-redis:1.2.0")