Todo List (Spring Boot)
Tech Stack
Features
- Mockk + Spring Mockk to mock beans.
- Kotest assertions provides fluent Kotlin DSL API for assertions in tests.
- Spring Doc to expose OpenAPI via Swagger at http://localhost:9090/actuator/webjars/swagger-ui/index.html
- Docker Compose to serve a running Postgres when running the application.
- Test persistence with a Postgres database running in TestContainers.
Prerequisites
Libraries
- Jackson
- Kotest
- Mockk
- PostgreSQL Driver SQL
- Spring Boot Starter Security
- Spring Data R2DBC SQL
- Spring Mockk
- Spring Reactive Webflux
- Test Containers
Troubleshooting
Ensure Java Home variable is set
echo $JAVA_HOME
Should see
/Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home
If not, you either don't have it downloaded, or Java Home variable is not set.
Ensure Java version is downloaded
/usr/libexec/java_home -V
Should see installed JDKs:
17.0.1 (x86_64) "Oracle Corporation" - "Java SE 17.0.1" /Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home
16.0.1 (x86_64) "Oracle Corporation" - "OpenJDK 16.0.1" /Users/user/Library/Java/JavaVirtualMachines/openjdk-16.0.1/Contents/Home
11.0.13 (x86_64) "Oracle Corporation" - "Java SE 11.0.13" /Library/Java/JavaVirtualMachines/jdk-11.0.13.jdk/Contents/Home
...
If not found, have not downloaded the JDK properly.
Ensure correct v17 is showing
/usr/libexec/java_home -v 17
Should see
/Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home
If you see a non-Oracle JDK, like open JDK, you need to uninstall it first.
Set Java Home variable
Find out what shell version you're using:
echo $SHELL
If you're using ZSH: you ought to be updating ~/.zshrc
else ~/.bash_profile
for the following steps.
Update your profile:
[emacs/vim/atom] ~/.zshrc
Add the following line:
export JAVA_HOME=$(/usr/libexec/java_home -v 17)
Update shell profile
source ~/.zshrc
Build & Run Project
Clean Project
./gradlew clean
Build Project
./gradlew build
Run Project
./gradlew bootRun --args='--spring.profiles.active=dev'
// or
./gradlew build
java -jar build/todo-xxxx.jar