4. Database & Redis Configuration
Open src/main/resources/application.properties (or create application.yml) and add connection details.
server:
port: 8080
spring:
application:
name: regent
profiles:
active: dev
# --- Flyway Config --- #
flyway:
enabled: true
url: jdbc:postgresql://localhost:5432/regent
user: regent
password: regent
locations: classpath:db/migration
# --- R2DBC Config --- #
r2dbc:
url: r2dbc:postgresql://localhost:5432/regent
username: regent
password: regent
pool:
enabled: true
initial-size: 5
max-size: 10
max-idle-time: 30000
max-life-time: 60000
# --- Redis Config --- #
data:
redis:
host: localhost
port: 6379
# password: regent
# database: 0
# -- Jackson Prettier Output (Optional for development) -- #
jackson:
serialization:
indent-output: trueImportant:
- Make sure you have PostgreSQL and Redis servers running.
- Create the database (
regentdb) and user (regentuser) in PostgreSQL with the specified password. Grant necessary privileges. - Flyway needs the standard JDBC URL, not the R2DBC one. Ensure you have the JDBC PostgreSQL driver dependency as well (Flyway usually pulls it in, or add
org.postgresql:postgresql).
Why always me?