Skip to content

This repository contains sample Amazon DynamoDB CRUD application with Spring Webflux and TestContainers integration.

License

Notifications You must be signed in to change notification settings

rbiedrawa/spring-webflux-aws-dynamodb

Repository files navigation

Spring Webflux CRUD application (Amazon DynamoDB)

This repository contains sample Aws DynamoDB CRUD application with Spring Webflux and TestContainers integration.

Features

Getting Started

Prerequisites

  • Java 11
  • Docker

Usage

  • Build docker image.

    ./gradlew bootBuildImage
  • Start docker-compose demo.

    docker-compose -f docker/docker-compose.yml -f docker/docker-compose.app.yml up -d
  • List containers and check if all are Up.

    docker-compose -f docker/docker-compose.yml -f docker/docker-compose.app.yml ps 
    
    #       Name                   Command                State             Ports         
    # -----------------------------------------------------------------------------------
    # app              /cnb/process/web                 Up         0.0.0.0:8080->8080/tcp
    # awscli           aws dynamodb create-table  ...   Exit 255                         
    # dynamodb         java -jar DynamoDBLocal.ja ...   Up         0.0.0.0:8000->8000/tcp
    # dynamodb-admin   node bin/dynamodb-admin.js       Up         0.0.0.0:8001->8001/tcp
  • Verify if 'users' table was successfully created. Use either curl -X GET --location "http://localhost:8080/users" or open your web browser and go to dynamo dashboard page.

  • Test other CRUD endpoints using curl e.g.:

    # Create new user:
    curl --header "Content-Type: application/json" \                                      
    --request POST \
    --data '{"email":"[email protected]"}' \
    http://localhost:8080/users
  • Stop docker-compose demo.

    docker-compose -f docker/docker-compose.yml -f docker/docker-compose.app.yml down -v

References

Additional Links

License

Distributed under the MIT License. See LICENSE for more information.

Releases

No releases published

Packages

 
 
 

Languages