spring and intellij setup

This commit is contained in:
2026-06-12 14:50:11 +03:00
parent d759f34bd9
commit b423a09f90
11 changed files with 113 additions and 2 deletions
+13
View File
@@ -0,0 +1,13 @@
DATABASE_URL=
DATABASE_USERNAME=
DATABASE_PASSWORD=
LOW_STOCK_THRESHOLD=10
FARE_BASE_FARE=100.00
FARE_PER_KM_RATE=50.00
FARE_MINIMUM_FARE=150.00
FARE_DEFAULT_SURGE_MULTIPLIER=1.0
FARE_CURRENCY=KES
SEED_DATA=true
+1
View File
@@ -35,3 +35,4 @@ out/
### VS Code ###
.vscode/
.env
+15 -1
View File
@@ -14,14 +14,28 @@ java {
}
}
repositories {
mavenCentral()
gradlePluginPortal()
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-validation")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
runtimeOnly("com.h2database:h2")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.mockito:mockito-core")
runtimeOnly("org.postgresql:postgresql")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
// dotenv
implementation("io.github.cdimascio:dotenv-java:3.2.0")
}
tasks.withType<Test> {
@@ -1,5 +1,6 @@
package com.andwati.orders;
import io.github.cdimascio.dotenv.Dotenv;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -7,6 +8,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
public class OrdersBackendApplication {
public static void main(String[] args) {
Dotenv dotenv = Dotenv.configure().ignoreIfMissing().systemProperties().load();
SpringApplication.run(OrdersBackendApplication.class, args);
}
@@ -0,0 +1,25 @@
spring:
datasource:
url: jdbc:h2:mem:orderfaretestdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
driver-class-name: org.h2.Driver
username: sa
password:
jpa:
hibernate:
ddl-auto: create-drop
open-in-view: false
show-sql: false
inventory:
low-stock-threshold: 10
fare:
base-fare: 100.00
per-km-rate: 50.00
minimum-fare: 150.00
default-surge-multiplier: 1.0
currency: KES
app:
seed-data: false
@@ -1 +1,23 @@
spring.application.name=orders-backend
server.port=8080
spring.application.name=orders
spring.datasource.url=${DATABASE_URL}
spring.datasource.username=${DATABASE_USERNAME}
spring.datasource.password=${DATABASE_PASSWORD}
spring.datasource.driver-class-name=org.postgresql.Driver
spring.jpa.hibernate.ddl-auto=update
spring.jpa.open-in-view=false
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.show-sql=false
inventory.low-stock-threshold=${LOW_STOCK_THRESHOLD:10}
fare.base-fare=${FARE_BASE_FARE:100.00}
fare.per-km-rate=${FARE_PER_KM_RATE:50.00}
fare.minimum-fare=${FARE_MINIMUM_FARE:150.00}
fare.default-surge-multiplier=${FARE_DEFAULT_SURGE_MULTIPLIER:1.0}
fare.currency=${FARE_CURRENCY:KES}
app.seed-data=${SEED_DATA:true}