/simple-spring-rest-service

Simple REST microservice implementation using Spring Boot.

Primary LanguageJavaMIT LicenseMIT

simple-spring-rest-service

develop: Build Status codecov
master: Build Status codecov

About

This repo is an example of a simple spring rest service that demonstrates some good practices (in my opinion) of how to structure a spring boot rest service and how to integrate unit testing, continuous integration, and code coverage reporting.

Running the Application

./gradlew clean assemble
./gradlew bootRun -Dspring.profiles.active=local

Testing the Application

  • Unit testing
    ./gradlew test
    
  • Through swagger-ui
    • With the application running navigate to http://localhost:9000/swagger-ui.html
    • You will see several controllers exposed including the Customer Controller which exposes the functionality for viewing all customers, viewing a specific customer, and adding a customer.
    • For more information on swagger visit http://swagger.io/
  • Through Postman
    • Importing the Postman collection into Postman and testing the pre-configured calls.
    /resources/postman/simpleSpringRestService.postman_collection.json
    
  • Through Advanced Rest Client
    • Importing the Advanced Rest Client project into Advanced Rest Client and testing the pre-configured calls.
    /resources/advanced-rest-client/simpleSpringRestService.json
    

Some Things Not Included With This Demo

  • Authentication
    • How authentication needs to be setup is pretty dependent on the way it plans to be used within the environment it is being deployed and the systems it needs to interact with so I left it out of this demo.

Some Things Included With This Demo

  • Continuous Integration
  • Code Coverage Analysis
    • Code coverage analysis is configured through codecov.io. For more information on codecov.io visit https://codecov.io/
  • Interactive documentation through swagger-ui and pre-configured test suites through Postman and Advanced Rest Client.