Skip to main content
This page documents the standard Spring Boot configuration patterns used throughout the SGIVU platform.

Application Identity

Application Name

Every service must define its application name, which is used for service discovery and identification:
spring.application.name
string
required
Unique identifier for the service in the microservices ecosystem. Used by Eureka for service registration and discovery.
spring:
  application:
    name: sgivu-user
The application name should follow the sgivu-{service} naming convention for consistency across the platform.

Server Configuration

Port Configuration

Services use environment-driven port configuration with sensible defaults:
server.port
integer
required
The HTTP port the service listens on. Uses the PORT environment variable with service-specific defaults.
server:
  port: ${PORT:8081}

Auth Service

Default: 9000

Gateway Service

Default: 8080

User Service

Default: 8081

Client Service

Default: 8082

Vehicle Service

Default: 8083

Purchase-Sale Service

Default: 8084

Discovery Service

Default: 8761

Forward Headers Strategy

Services behind proxies use the forward headers strategy to properly handle proxy headers:
server.forward-headers-strategy
string
Configures how the server handles forwarded headers (X-Forwarded-*). Set to framework to let Spring handle them automatically.
server:
  forward-headers-strategy: framework
This setting is critical for services behind the gateway or load balancers to correctly identify client IP addresses and original request URLs.

JPA Configuration

Open In View

All data-access services disable the Open Session In View pattern:
spring.jpa.open-in-view
boolean
Controls whether JPA sessions remain open during view rendering. Set to false in all SGIVU services to prevent lazy loading issues and improve performance.
spring:
  jpa:
    open-in-view: false
Keeping open-in-view: false is a best practice for REST APIs. It prevents accidental lazy loading in controllers and ensures explicit transaction boundaries.

JPA Properties (Profile-Specific)

Development environments enable SQL logging:
spring:
  jpa:
    show-sql: true
    properties:
      hibernate:
        format_sql: true
Production environments use minimal logging:
spring:
  jpa:
    hibernate:
      ddl-auto: validate

Session Management

Session Store Types

SGIVU uses two session storage strategies depending on service requirements:

Redis Sessions (Stateless Services)

The Gateway uses Redis for distributed session management:
spring:
  session:
    store-type: redis
    timeout: 1h
    redis:
      namespace: spring:session:sgivu-gateway
  data:
    redis:
      host: ${REDIS_HOST:sgivu-redis}
      port: ${REDIS_PORT:6379}
      password: ${REDIS_PASSWORD}
spring.session.store-type
string
Session storage mechanism. Use redis for distributed sessions across gateway instances.
spring.session.redis.namespace
string
Redis key prefix for session data. Prevents key collisions when multiple services share the same Redis instance.

JDBC Sessions (Stateful Services)

The Auth Service uses database-backed sessions:
spring:
  session:
    store-type: jdbc
    jdbc:
      initialize-schema: never
      table-name: SPRING_SESSION
      cleanup-cron: 0 */15 * * * *
      flush-mode: on_save
      save-mode: on_get_attribute
spring.session.jdbc.initialize-schema
string
Controls session table creation. Set to never since Flyway manages the schema.
spring.session.jdbc.cleanup-cron
string
Cron expression for expired session cleanup. Runs every 15 minutes by default.
Use Redis when:
  • Service requires horizontal scaling
  • Sessions are lightweight and temporary
  • Service is stateless (like the gateway)
Use JDBC when:
  • Service already has database access
  • Sessions contain critical data
  • Service requires session persistence across restarts

API Documentation (SpringDoc)

All services use SpringDoc OpenAPI 3 with centralized documentation routing:
springdoc.swagger-ui.url
string
Location of the OpenAPI JSON specification for this service.
springdoc.swagger-ui.configUrl
string
Location of the Swagger UI configuration.

Service-Specific Configurations

# Auth Service
springdoc:
  swagger-ui:
    url: /docs/auth/v3/api-docs
    configUrl: /docs/auth/v3/api-docs/swagger-config
# User Service
springdoc:
  swagger-ui:
    url: /docs/user/v3/api-docs
    configUrl: /docs/user/v3/api-docs/swagger-config
# Vehicle Service
springdoc:
  swagger-ui:
    url: /docs/vehicle/v3/api-docs
    configUrl: /docs/vehicle/v3/api-docs/swagger-config
All API documentation is accessible through the gateway at /docs/{service}/v3/api-docs. This provides a centralized location for API exploration.

Eureka Settings

Service discovery and registration configuration

Database Config

Database connection and migration settings

Observability

Monitoring, tracing, and logging configuration

Environment Variables

Required and optional environment variables

Build docs developers (and LLMs) love