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
+16
View File
@@ -0,0 +1,16 @@
.gradle/
build/
out/
*.class
.env
.env.*
!.env.example
.idea/
.vscode/
.DS_Store
logs/
*.log
+11
View File
@@ -1,5 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Gradle Imported" enabled="true">
<outputRelativeToContentRoot value="true" />
<processorPath useClasspath="false">
<entry name="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-configuration-processor/4.1.0/c3e27f93b579220e4e18fe941321525200eb36b/spring-boot-configuration-processor-4.1.0.jar" />
</processorPath>
<module name="orders.main" />
</profile>
</annotationProcessing>
</component>
<component name="JavacSettings">
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
<module name="orders" options="-parameters" />
+3
View File
@@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$/orders-backend" />
</component>
<component name="KubernetesApiProvider"><![CDATA[{}]]></component>
<component name="ProjectRootManager" version="2">
<output url="file://$PROJECT_DIR$/out" />
+1
View File
@@ -4,6 +4,7 @@
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/cymelle.iml" filepath="$PROJECT_DIR$/.idea/cymelle.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/orders.iml" filepath="$PROJECT_DIR$/.idea/modules/orders.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/orders.main.iml" filepath="$PROJECT_DIR$/.idea/modules/orders.main.iml" />
</modules>
</component>
</project>
+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}
+1
View File
@@ -8,6 +8,7 @@ import babel from '@rolldown/plugin-babel'
import tailwindcss from '@tailwindcss/vite'
import { nitro } from 'nitro/vite'
// @ts-ignore
const config = defineConfig({
plugins: [
devtools(),