Provides Sample of Project for Spring Boot and Java/Kotlin with maven setup. The project can serve as a template for starting a project in Spring Boot with 4 options:
- Java - uses Java with the classic spring Boot recommended architecture
- Java Hexagonal - uses Java with Hexagonal architecture
- Kotlin - uses Kotlin with the classic spring Boot recommended architecture
- Kotlin Hexagonal - uses Kotlin with Hexagonal architecture
- JDK 17
- Any IDE with lombok plugin installed
Import as a java project in an IDE of your choice.
Install and configure Postgres locally. For mac follow the link.
Install locally a Postgres client (eg PgAdmin )
Depending on which of the 4 options you choose to follow:
Run mvn clean install -Dlanguage=kotlinHexagonal
(kotlin/java/javaHexagonal). This will generate the appropriate jar, that will be run later on.
Before running the app set the following env variables (take advantage of the IDEA run configuration)
ACTIVE_PROFILE=
dev / qa / prod
DATABASE_HOST=
DATABASE_PORT=
DATABASE_NAME=
DATABASE_USER=
DATABASE_PASSWORD=
Run mvn spring-boot:run -f pom.xml
Create directory to store db files /var/lib/postgresql/data/
Depending on which of the 4 options (language/architecture) you choose to follow:
docker build --build-arg language=kotlinHexagonal -t template_app .
(kotlinHexagonal
can be replaced with kotlin
, java
or javaHexagonal
)
Edit database connection properties in run.sh
Run sh run.sh
mvn test