Code Monkey home page Code Monkey logo

city-tasks-spring-boot-error-handling's Introduction

Error Handing on Spring Native app with WebFlux and i18n.

  • Author: Andres Solorzano.
  • Level: Advanced.
  • Technologies: Java, Spring Boot, Spring Native, Spring WebFlux, Quartz, Flyway, Testcontainers, Postgres, DynamoDB and Docker.

Description

This project uses the Spring Boot Framework to handle errors in a Spring Native application that uses WebFlux and i18n. The idea is to use a TDD methodology from the beginning with the support of Testcontainers to execute the Integration Tests. This project also uses Docker with the compose plugin to deploy a local cluster alongside the other required services by the Spring Boot microservice.

GraalVM Native Support

This project has been configured to let you generate either a lightweight container or a native executable. It is also possible to run your tests in a native image.

NOTE: GraalVM 22.3+ is required.

Running the application using Docker Compose

First, generate the Spring Native image:

./mvnw clean -Pnative native:compile

Then, execute the following command from the root of the project:

docker compose up --build

Getting a Device item from DynamoDB from LocalStack

Execute the following command:

aws dynamodb scan         \
  --table-name Devices    \
  --endpoint-url http://localhost:4566

Using the Executable only

Use this option if you want to explore more options such as running your tests in a native image. IMPORTANT: The GraalVM native-image compiler should be installed and configured on your machine.

Deploy the required services using Docker Compose command:

docker compose up tasks-postgres tasks-localstack

Open a new terminal window and export the following environment variables:

export HIPERIUM_CITY_TASKS_DB_CLUSTER_SECRET='{"dbClusterIdentifier":"hiperium-city-tasks-db-cluster","password":"postgres123","dbname":"HiperiumCityTasksDB","engine":"postgres","port":5432,"host":"localhost","username":"postgres"}'
export AWS_DEFAULT_REGION=ap-southeast-2
export AWS_ACCESS_KEY_ID=DUMMY
export AWS_SECRET_ACCESS_KEY=DUMMY
export AWS_ENDPOINT_OVERRIDE=http://localhost:4566

Then, create and run the native executable from the project's root directory:

$ ./mvnw clean native:compile -Pnative spring-boot:run

You can also run your existing tests suite in a native image. This is an efficient way to validate the compatibility of your application.

To run your existing tests in a native image, run the following goal:

$ ./mvnw test -PnativeTest

Reference Documentation

For further reference, please consider the following sections:

Guides

The following guides illustrate how to use some features concretely:

Additional Links

These additional references should also help you:

city-tasks-spring-boot-error-handling's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.