Skip to content

mihaelveber/springboot-bestpractice

 
 

Repository files navigation

SpringBoot best practice

Build Status MIT License

About Spring Boot best practice architecture.

Environment

$ SPRING_PROFILES_ACTIVE=""

$ MYSQL_DB_HOST=""
$ MYSQL_DB_NAME=""
$ MYSQL_DB_USER=""
$ MYSQL_DB_PASS=""

$ REDIS_DB_HOST=""
$ REDIS_DB_PORT=""
$ REDIS_DB_PASS=""

Local environment

Local development property file is application-loc.yml.

$ SPRING_PROFILES_ACTIVE="local"

Working on docker container.

  • Docker Image
    • MySQL
    • Redis
    • OpenJDK

Cassandra cluster.

  • CentOS7 virtual machine
  • 3 nodes

MySQL

Sample query is sql/mysql_sample.sql file.

Sample Class

  • UserEntity.java
  • UserService.java
  • UserRepository.java
  • InfoEntity.java
  • InfoService.java
  • InfoRepository.java

Redis

Sample Class

  • UserService

Develop environment

Develop development property file is application-dev.yml.

$ SPRING_PROFILES_ACTIVE="dev"

Build

Git clone

$ git clone https://github.com/tomoyane/springboot-bestpractice.git

Run test

./gradlew test

Using docker container

Docker image build

  • Build SpringBoot best practice application.
  • Use docker for local development.
    • MySQL
    • Redis
    • OpenJDK
$ docker-compose -f docker-compose-local.yml build

Run container

$ docker-compose -f docker-compose-local.yml up -d

Authentication and Authorization

Spring security.

JWT.

Architecture

spring-boot-bestpracite
├── main
│   ├── java
│   │    └── com
│   │        └── bestpractice
│   │           └── api
│   │               ├── App.java
│   │               ├── common
│   │               │   ├── config
│   │               │   ├── property
│   │               │   └── util
│   │               │
│   │               ├── controller
│   │               │   ├── Advice.java
│   │               │   ├── v1
│   │               │   └── v2
│   │               │
│   │               ├── domain
│   │               │   ├── entity
│   │               │   ├── model
│   │               │   ├── repository
│   │               │   └── service
│   │               │
│   │               ├── exception
│   │               │
│   │               └── security
│   │                   ├── filter
│   │                   └── role
│   │ 
│   └── resources
│       ├── application-dev.yml
│       └── application-local.yml
└── test
    ├── java
    │   └── com
    │       └── bestpractice
    │           └── api
    │               ├── AppTests.java
    │               │
    │               ├── common
    │               │
    │               ├── controller
    │               │
    │               ├── repository
    │               │
    │               └── service
    │
    └── resources
        └── application-test.yml

License

MIT

About

SpringBoot best practice. Using Spring Security, Spring Data JPA.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Java 98.4%
  • Dockerfile 1.2%
  • Shell 0.4%