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
This commit is contained in:
vsxd 2026-03-11 22:57:03 +08:00
parent b7cc6b883f
commit e726746f4d
4 changed files with 91 additions and 0 deletions

View file

@ -39,6 +39,32 @@
<groupId>com.skillhub</groupId>
<artifactId>skillhub-infra</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-database-postgresql</artifactId>
<version>10.10.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>

View file

@ -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);
}
}

View file

@ -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

View file

@ -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