Skip to content

D4rK3oN/spring-boot-2-simple-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Coverage Status JitPack Contributors Issues LinkedIn


logo

Microservices with Spring Boot 2

A simple example of a microservice

Table of Contents

About The Project

There are many great samples of microservices with Spring Boot 2 available on GitHub.
With the passage of time, I have thought of collecting in a mini-project all those tasks that I usually need in my day to day to accelerate my developments.

Getting Started

Here are some instructions on how to configure your project locally.
To get a local copy up and running follow these simple steps.

Prerequisites

This is a list things that you need to use the software and how to configure them.

  • MongoDB Server (optional)

    • We can download the Community Server from their website
    • A good alternative to installing a MongoDB server is create a MongoDB container in Docker.
  • Docker Desktop

    • The software can be download from their website
# Create volumes in docker to save data (optional)
docker volume create mongodb-vol
docker volume create microservices-vol

# Download and run MongoDB container
docker pull mongo
docker run -d -p 27017:27017 -v mongodb-vol:/data/db --name mongodb mongo

Installation

Execute with docker

docker pull d4rk3on/spring-boot-2-simple-example:{version}
docker run -d -p 9080:9080 -e DEV_PATH='/' -e SPRING_PROFILES_ACTIVE='docker' -v microservices-vol:/resources --link mongodb --name spring-boot-example d4rk3on/spring-boot-2-simple-example:{version}

Execute without docker

  1. Clone the repository
git clone https://github.com/D4rK3oN/spring-boot-2-simple-example.git
  1. Configure environment variables
    Add DEV_PATH var with the path where you want to save the logs, etc
<!-- e.g. used in logback.xml -->
<file>${DEV_PATH}/resources/spring-boot-2-simple-example/logs/simple_example.log</file>
  1. Configure the properties of the application-dev.yml file (if you need it)
spring.data.mongodb:
  host: localhost
  port: 27017
  1. Run/Debug the project with the profile "dev"
Program args: --spring.profiles.active=dev

run config

Swagger-UI

Swagger generated by springfox 3.0.0 : http://localhost:8080/swagger-ui/index.html#/

Roadmap

See the open issues for a list of proposed features (and known issues).