Skip to content

marciovmartins/study-springboot-i18n

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

My Stock Mgmt Banner image with an anthropomorphous bull with glasses wearing an white office shirt, holding a pencil in one hand and a notebook in another and the title 'My Stock Mgmt'

Spring icon Docker icon

⤴️ Table of Contents

❓ About

Study about Spring Boot with i18n and Problem Detail.

The default error message do not provide useful information. The ResponseEntityExceptionHandler is extended and expanded the error information. Also, an HTML page was added with a human-readable documentation that can be followed and get more details about the error.

The problem+detail response was expanded to contain useful information about the errors:

{
  "errors": [
    {
      "detail": "size must be between 1 and 250",
      "pointer": "name"
    }
  ],
  "type": "http://localhost:8080/api-docs/errors/v1/validation-failure",
  "title": "Validation failure",
  "status": 400,
  "instance": "/people/8c78fa21-cc03-4ef1-8882-cd51e208b7d2"
}

Back to Top

🏃 How to Run

The docker-compose should be at version 2.21 or greater.

IntelliJ

Find the main file at: src/main/kotlin/dev/martins/marcio/studies/springbooti18n/SpringbootI18nApplication.kt

Execute it clicking on the "play" button and after that in Run.

find the springbooti18nApplication and execute it

In case of an error for missing dependencies, reload it with maven command "Reload All Maven Projects":

Back to Top

Maven

mvn spring-boot:run

Back to Top

Docker

docker run --rm -v $PWD/src:/src -v $PWD/pom.xml:/pom.xml -v $PWD/config:/config -v data:/root/.m2 -p 8080:8080 maven:3.8.8-eclipse-temurin-21-alpine mvn spring-boot:run

Back to Top

🚦 How to Test

Intellij

To run all the unit and integration tests, right-click on the root folder and select "Run All Tests".

find the SpringbootI18nApplication and execute it

Back to Top

Maven

Unit tests:

mvn test

Unit tests + Integration tests:

mvn verify

Back to Top

Docker

Unit tests:

docker run --rm -v $PWD/src:/src -v $PWD/pom.xml:/pom.xml -v $PWD/config:/config -v data:/root/.m2 -p 8080:8080 maven:3.8.8-eclipse-temurin-21-alpine mvn test

Unit tests + Integration tests:

docker run --rm -v $PWD/src:/src -v $PWD/pom.xml:/pom.xml -v $PWD/config:/config -v data:/root/.m2 -p 8080:8080 maven:3.8.8-eclipse-temurin-21-alpine mvn verify

Back to Top

Manually

There are scripts to help you to make requests to the application. Check the steps below:

The application must be running, check the documentation section for some useful links and check the intellij http client scripts folder which already contains requests scripts.

Check IntelliJ Http Client Documentation about how to set up the private variables. For example:

http-client.private.env.json

{
  "development": {
    "person_name": "John Doe",
    "person_age": "18"
  }
}

Back to Top

📖 Documentation

The application use the HATEOAS principle with HALS and HALS Form. From the root resource it is possible to discover the api capabilities.

There is also OpenApi documentation:

Env Url
Local http://localhost:8080/api-docs

And the open api json is defined at:

Env Url
Local http://localhost:8080/openapi.json

Back to Top

🔧 Tools

Check the HELP.md file with a list of links and articles about the tools used in this project.

Back to Top

📖 References

Back to Top

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks