From e726746f4d92275b7118fc2c07fc84aa58e1bf4a Mon Sep 17 00:00:00 2001 From: vsxd Date: Wed, 11 Mar 2026 22:57:03 +0800 Subject: [PATCH] feat: add Spring Boot application entry point and base configuration - Create SkillhubApplication main class - Add application.yml with JPA, Flyway, graceful shutdown config - Add application-local.yml for local development profile - Add database and Redis dependencies to skillhub-app POM --- server/skillhub-app/pom.xml | 26 ++++++++++++++ .../com/skillhub/SkillhubApplication.java | 11 ++++++ .../src/main/resources/application-local.yml | 20 +++++++++++ .../src/main/resources/application.yml | 34 +++++++++++++++++++ 4 files changed, 91 insertions(+) create mode 100644 server/skillhub-app/src/main/java/com/skillhub/SkillhubApplication.java create mode 100644 server/skillhub-app/src/main/resources/application-local.yml create mode 100644 server/skillhub-app/src/main/resources/application.yml diff --git a/server/skillhub-app/pom.xml b/server/skillhub-app/pom.xml index f770ce57..f80badea 100644 --- a/server/skillhub-app/pom.xml +++ b/server/skillhub-app/pom.xml @@ -39,6 +39,32 @@ com.skillhub skillhub-infra + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.postgresql + postgresql + runtime + + + org.flywaydb + flyway-core + + + org.flywaydb + flyway-database-postgresql + 10.10.0 + + + org.springframework.boot + spring-boot-starter-data-redis + + + org.springframework.session + spring-session-data-redis + org.springframework.boot spring-boot-starter-test diff --git a/server/skillhub-app/src/main/java/com/skillhub/SkillhubApplication.java b/server/skillhub-app/src/main/java/com/skillhub/SkillhubApplication.java new file mode 100644 index 00000000..6c5c5d38 --- /dev/null +++ b/server/skillhub-app/src/main/java/com/skillhub/SkillhubApplication.java @@ -0,0 +1,11 @@ +package com.skillhub; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class SkillhubApplication { + public static void main(String[] args) { + SpringApplication.run(SkillhubApplication.class, args); + } +} diff --git a/server/skillhub-app/src/main/resources/application-local.yml b/server/skillhub-app/src/main/resources/application-local.yml new file mode 100644 index 00000000..4cdcbe15 --- /dev/null +++ b/server/skillhub-app/src/main/resources/application-local.yml @@ -0,0 +1,20 @@ +spring: + jpa: + hibernate: + ddl-auto: validate + show-sql: true + flyway: + enabled: true + datasource: + url: jdbc:postgresql://localhost:5432/skillhub + username: skillhub + password: skillhub_dev + data: + redis: + host: localhost + port: 6379 + +logging: + level: + com.skillhub: DEBUG + org.springframework.security: DEBUG diff --git a/server/skillhub-app/src/main/resources/application.yml b/server/skillhub-app/src/main/resources/application.yml new file mode 100644 index 00000000..df379f38 --- /dev/null +++ b/server/skillhub-app/src/main/resources/application.yml @@ -0,0 +1,34 @@ +server: + port: 8080 + shutdown: graceful + +spring: + application: + name: skillhub + lifecycle: + timeout-per-shutdown-phase: 30s + jpa: + hibernate: + ddl-auto: validate + open-in-view: false + properties: + hibernate: + dialect: org.hibernate.dialect.PostgreSQLDialect + flyway: + enabled: true + locations: classpath:db/migration + datasource: + url: jdbc:postgresql://localhost:5432/skillhub + username: skillhub + password: skillhub_dev + hikari: + maximum-pool-size: 10 + +management: + endpoints: + web: + exposure: + include: health,info + endpoint: + health: + show-details: when-authorized