Skip to content

Wanatchapong/springboot-example-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🥾 Spring-Boot Example Service

Minimal example Spring Boot application

⚙️ Prerequisites

The followings are needed to build, test and run the project.

Dependencies:

  • Spring Web 🕸️
  • Spring Data JPA 📓
  • Spring Validation 💪
  • Spring Boot DevTools ⚒️
  • Lombok 🌶️
  • H2 Database 🗄️
  • JUnit 5 🧪
  • Mockito 🍸

🚗 Getting Started

Follow the below instructions to build, test and run the project on your local machine.

Clone

Get started by cloning this repository using git command.

git clone git@github.com:Wanatchapong/springboot-example-service.git

Compile

And compile the project using the following maven command.

mvn compile 

Build jar file

And build the project jar file using the following maven command.

mvn package 

Test

Unit test project using the following maven command.

mvn test

Run

Run project using the following maven command.

mvn spring-boot:run

or run from the jar file

java -jar target/<projectname-version>.jar 

🐳 Docker

  1. Compile source code and package it in its distribution format as JAR
mvn package
  1. Build docker image and tag the name of image name:tag. If not pass a tag, Docker uses "latest" as its default tag.
docker build -t springboot-example-service .
  1. Run docker image in detached mode
docker run -d -p 8080:8080 -t springboot-example-service

🚀 Try it out

Open a terminal then make a GET request to the server using the curl command.

curl --request GET \
--url http://localhost:8080/todo \
--header 'content-type: application/json'

About

Example RESTful APIs Service for Spring Boot

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published