Some experimentation with Spring Boot 2, JDK8+, NoSQL, etc. It demonstrates usage of:
- Maven and Gradle build tools
- Spring Boot 2 + Spring Framework 5 and migration from Spring Boot 1 + Spring Framework 4
- built with JDK8 and newer JDKs on Travis CI
- Spring Web, REST API
- Spring Security, to authenticate users via auth_basic, and fetch authentication data from MongoDB instead of default SQL database
- Spring Data to serve data from a MongoDB database
- Spring Batch to schedule and manage some tasks
- Spring Cache via Redis for application, and prefer an embedded cache provider during tests
- integration tests and (some) unit-test via TestNG, because TestNG is so much superior to JUnit4/5... (better keywords, dataproviders, old/mature and very stable API, easily configurable, test suites)
- tests work with an embedded MongoDB instance (for data) and HSQLDB (for Spring Batch internals only), that means you don't have to install any database to test project
- integration with some free (for open-source) services like AppVeyor (Windows CI), Travis (Linux and MacOS CI), Cirrus (CI), CodeCov (code coverage), SonarCloud (code quality), LGTM (code quality)
- Maven and Gradle wrappers, and a
do.cmdscript that helps you to launch some usefull commands - code coverage thanks to JaCoCo Maven and Gradle plugin
- some AOP to capture performance of API endpoints
- Spring Actuator web endpoints configured
- Swagger UI to provide documentation about REST API endpoints
- Docker builds without Docker daemon thanks to Jib. Docker Compose support. Linux base image is Distroless
For fun and to show some skills 🐱
Jonathan Lermitage (jonathan.lermitage@gmail.com)
Linkedin profile: jonathan-lermitage-092711142
- active
- spring5-light: like spring5, JDK8+ (JDK11 supported), Docker Compose, without Redis Cache
- archived
- spring5: based on Spring Framework 5, Spring Boot 2 and JDK8/9, use Spring Web (REST API), Security, Data (regular and embedded MongoDB), Batch, Cache (Redis), AOP, Actuator, Swagger UI
- spring5-light-docker-jib: Docker build thanks to Jib. See DEPLOY.md to package and run application. See commit de7335b
- spring5-light-batch: Spring Batch support. See commit c0e3422
- spring5-embedmongo: use embedded MongoDB during tests. See commits 37e1be5 and 161d321
- spring5-light-mongo4.0.x: make embedded MongoDB work with version from 3.6 to 4.0. See commit a75a917
- spring5-swagger: enable Swagger UI. Run application and check
http://localhost:8080/swagger-ui.html, authenticate withROOT/woot. See commit429ae53834852c - spring5-redis: enable Redis cache, and prefer embedded cache during tests. See commits a911f6a, 7e26822 and ae6e0e6
- spring5-mvn-to-gradle: migration from Maven to Gradle. Stable and functional, but still needs some improvements
- spring4: previous active branch, based on Spring Framework 4, Spring Boot and JDK8
- spring4-redis-cache: enable caching based on Redis server. See commit 0f1eff7
- other branches may appear and disappear quickly, depending on experimentation results and motivation ;-)
You can use the do.cmd (Windows) or do.sh (Unix shell) script:
do help show this help message
do t test without code coverage (with embedded MongoDB)
do tc test with code coverage (with embedded MongoDB)
do sc compute and upload Sonar analysis to SonarCloud, needs two env vars:
- TK1_MANON_SONAR_ORGA SonarCloud organization, e.g. jonathanlermitage-github
- TK1_MANON_SONAR_LOGIN SonarCloud authentication token
do tsc similar to "do tc" then "do sc"
do b build without testing
do c clean
do p package application to manon.jar
do rd package and run application with dev profile
do w 3.5.2 set or upgrade Maven wrapper to 3.5.2
do cv check plugins and dependencies versions
do uv update plugins and dependencies versions
do dt show dependencies tree
do rmi stop Docker application, then remove its containers and images
do cdi clean up dangling Docker images
do jib build Docker image to a Docker daemon
do jibtar build and save Docker image to a tarball
MIT License. In other words, you can do what you want: this project is entirely OpenSource, Free and Gratis.
