Skip to content
This repository was archived by the owner on Jul 1, 2025. It is now read-only.

Commit dd0ac9a

Browse files
dfcoffinclaude
andcommitted
Implement comprehensive Spring Boot 3.5 profile configuration system
## Summary - Create modern Spring Boot 3.5 profile configurations for all environments - Maintain backward compatibility with legacy profile names - Implement proper architectural separation for dependency library vs applications ## New Spring Boot 3.5 Profiles - **dev-mysql**: MySQL development environment (default active) - **dev-postgresql**: PostgreSQL development environment - **prod**: Production environment with externalized configuration - **local**: H2 in-memory for local development - **docker**: Docker containerized environments - **aws-sandbox**: Green Button Alliance AWS Sandbox ## Legacy Profile Compatibility - **devmysql** → maps to **dev-mysql** - **awsgbasandbox** → maps to **aws-sandbox** - **dev** → maps to **local** ## Key Features - **Database Support**: MySQL, PostgreSQL, H2 with optimized connection pooling - **Environment Variables**: Externalized configuration for production deployment - **Flyway Ready**: Database migration configuration for all environments - **Development Tools**: H2 console, debug logging, SQL tracing for development - **Production Hardened**: Minimal logging, SSL configuration, security-first approach - **ESPI Compliance**: Standard-specific configuration management ## Architectural Decision - **Actuator endpoints disabled by default** in OpenESPI-Common (dependency library) - **Applications (DataCustodian/ThirdParty) should configure their own monitoring** - **Clean separation**: Library provides configuration foundation, applications add web endpoints ## Usage Examples ```bash mvn spring-boot:run -P dev-mysql # MySQL development (default) mvn spring-boot:run -P dev-postgresql # PostgreSQL development mvn spring-boot:run -P local # H2 local development mvn spring-boot:run -P prod # Production with env vars mvn spring-boot:run -P devmysql # Legacy compatibility ``` ## Files Added - application-dev-mysql.yml - application-dev-postgresql.yml - application-prod.yml - application-local.yml - application-docker.yml - application-aws-sandbox.yml - PROFILE_MIGRATION_SUMMARY.md 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 02b7bd7 commit dd0ac9a

9 files changed

+1042
-8
lines changed

PROFILE_MIGRATION_SUMMARY.md

Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
1+
# Spring Boot 3.5 Profile Migration Summary
2+
3+
## Overview
4+
This document outlines the migration from legacy profile configuration to modern Spring Boot 3.5 profile management for OpenESPI-Common.
5+
6+
## ✅ New Spring Boot 3.5 Profiles Created
7+
8+
### 1. **dev-mysql** (Default Active)
9+
- **File**: `application-dev-mysql.yml`
10+
- **Purpose**: MySQL development environment
11+
- **Database**: MySQL 8.0+ with openespi_dev database
12+
- **Features**: Debug logging, Flyway migrations, H2 console disabled
13+
- **Usage**: `mvn spring-boot:run -P dev-mysql`
14+
15+
### 2. **dev-postgresql**
16+
- **File**: `application-dev-postgresql.yml`
17+
- **Purpose**: PostgreSQL development environment
18+
- **Database**: PostgreSQL 13+ with openespi_dev database
19+
- **Features**: Debug logging, Flyway migrations, PostgreSQL-specific configuration
20+
- **Usage**: `mvn spring-boot:run -P dev-postgresql`
21+
22+
### 3. **prod**
23+
- **File**: `application-prod.yml`
24+
- **Purpose**: Production environment
25+
- **Database**: Environment-specific (supports MySQL/PostgreSQL)
26+
- **Features**: Minimal logging, SSL required, environment variables
27+
- **Usage**: `mvn spring-boot:run -P prod`
28+
29+
### 4. **local**
30+
- **File**: `application-local.yml`
31+
- **Purpose**: Local development with H2 in-memory database
32+
- **Database**: H2 in-memory with sample data
33+
- **Features**: H2 console enabled, debug logging, create-drop schema
34+
- **Usage**: `mvn spring-boot:run -P local`
35+
36+
### 5. **docker**
37+
- **File**: `application-docker.yml`
38+
- **Purpose**: Docker containerized environments
39+
- **Database**: MySQL via Docker Compose service
40+
- **Features**: Container-optimized settings, Prometheus metrics
41+
- **Usage**: `mvn spring-boot:run -P docker`
42+
43+
### 6. **aws-sandbox**
44+
- **File**: `application-aws-sandbox.yml`
45+
- **Purpose**: Green Button Alliance AWS Sandbox
46+
- **Database**: AWS RDS MySQL
47+
- **Features**: CloudWatch integration, GBA-specific settings
48+
- **Usage**: `mvn spring-boot:run -P aws-sandbox`
49+
50+
### 7. **test** (Existing)
51+
- **File**: `application-test.yml` / `application-test.properties`
52+
- **Purpose**: JUnit 5 testing with H2 in-memory
53+
- **Database**: H2 in-memory for tests
54+
- **Features**: Test-specific configuration, ESPI test data
55+
56+
## 🔄 Legacy Profile Compatibility
57+
58+
### Maintained for Backward Compatibility:
59+
- **`devmysql`** → Maps to `dev-mysql`
60+
- **`awsgbasandbox`** → Maps to `aws-sandbox`
61+
- **`dev`** → Maps to `local`
62+
63+
### Profile Migration Mapping:
64+
```bash
65+
# Legacy → Modern
66+
mvn -P devmysql → mvn -P dev-mysql
67+
mvn -P awsgbasandbox → mvn -P aws-sandbox
68+
mvn -P dev → mvn -P local
69+
```
70+
71+
## 📋 Configuration Features
72+
73+
### Database Configuration
74+
- **Connection Pooling**: HikariCP with optimized settings
75+
- **Flyway Migrations**: Automatic database schema management
76+
- **Multi-Schema Support**: Separate schemas for usage and customer data
77+
- **Environment Variables**: Externalized configuration for production
78+
79+
### Logging Configuration
80+
- **Development**: DEBUG level with SQL logging
81+
- **Production**: INFO level with minimal output
82+
- **Pattern**: Consistent timestamp and thread information
83+
- **File Logging**: Environment-specific log files
84+
85+
### Management & Monitoring
86+
- **Basic Configuration**: Foundation for actuator setup (endpoints disabled by default)
87+
- **Application Responsibility**: DataCustodian and ThirdParty should configure specific endpoints
88+
- **Info Endpoint**: Basic environment information available
89+
- **Monitoring Integration**: Applications should add Prometheus, CloudWatch, etc.
90+
91+
### ESPI-Specific Configuration
92+
- **UUID Namespaces**: ESPI-compliant namespace definitions
93+
- **Schema Configuration**: Usage and customer schema separation
94+
- **Debug Features**: Development-specific ESPI debugging
95+
96+
## 🚀 Usage Examples
97+
98+
### Development with MySQL:
99+
```bash
100+
mvn spring-boot:run -P dev-mysql
101+
# Uses: application-dev-mysql.yml
102+
# Database: MySQL localhost:3306/openespi_dev
103+
```
104+
105+
### Development with PostgreSQL:
106+
```bash
107+
mvn spring-boot:run -P dev-postgresql
108+
# Uses: application-dev-postgresql.yml
109+
# Database: PostgreSQL localhost:5432/openespi_dev
110+
```
111+
112+
### Local Development (H2):
113+
```bash
114+
mvn spring-boot:run -P local
115+
# Uses: application-local.yml
116+
# Database: H2 in-memory
117+
# H2 Console: http://localhost:8080/h2-console
118+
```
119+
120+
### Production Deployment:
121+
```bash
122+
mvn spring-boot:run -P prod \
123+
-DDB_URL=jdbc:mysql://prod-db:3306/openespi \
124+
-DDB_USERNAME=prod_user \
125+
-DDB_PASSWORD=secure_password
126+
```
127+
128+
### Docker Environment:
129+
```bash
130+
mvn spring-boot:run -P docker
131+
# Uses: application-docker.yml
132+
# Database: MySQL container via Docker Compose
133+
```
134+
135+
## 🔧 Environment Variables
136+
137+
### Production Environment Variables:
138+
```bash
139+
# Database Configuration
140+
DB_URL=jdbc:mysql://localhost:3306/openespi_prod
141+
DB_USERNAME=openespi_user
142+
DB_PASSWORD=secure_password
143+
DB_DRIVER=com.mysql.cj.jdbc.Driver
144+
145+
# SSL Configuration
146+
SSL_ENABLED=true
147+
SSL_KEYSTORE_PATH=/path/to/keystore.p12
148+
SSL_KEYSTORE_PASSWORD=keystore_password
149+
150+
# OAuth2 Configuration
151+
OAUTH2_ISSUER_URI=https://auth.example.com
152+
```
153+
154+
## 📁 File Structure
155+
```
156+
src/main/resources/
157+
├── application.properties # Default configuration
158+
├── application-dev-mysql.yml # MySQL development
159+
├── application-dev-postgresql.yml # PostgreSQL development
160+
├── application-prod.yml # Production
161+
├── application-local.yml # Local development (H2)
162+
├── application-docker.yml # Docker environment
163+
└── application-aws-sandbox.yml # GBA AWS Sandbox
164+
165+
src/test/resources/
166+
├── application-test.yml # JUnit 5 tests
167+
└── application-test.properties # Test configuration
168+
```
169+
170+
## ✅ Benefits of New Profile System
171+
172+
1. **Environment Parity**: Consistent configuration across all environments
173+
2. **Externalized Configuration**: Production secrets via environment variables
174+
3. **Database Flexibility**: Support for MySQL, PostgreSQL, and H2
175+
4. **Monitoring Ready**: Built-in actuator and metrics configuration
176+
5. **Security First**: Production profiles secure by default
177+
6. **Development Friendly**: Rich debugging and console access for development
178+
7. **Container Ready**: Docker and Kubernetes deployment support
179+
8. **ESPI Compliant**: Standard-specific configuration management
180+
181+
## 🔍 Validation
182+
183+
### Profile Validation Commands:
184+
```bash
185+
# List all available profiles
186+
mvn help:all-profiles
187+
188+
# Test profile activation
189+
mvn help:effective-pom -P dev-postgresql
190+
191+
# Validate configuration
192+
mvn spring-boot:run -P local --dry-run
193+
```
194+
195+
## 🏗️ Architectural Design Decisions
196+
197+
### Actuator and Monitoring Placement
198+
**Decision**: Actuator endpoints and monitoring configurations are **NOT** included in OpenESPI-Common profiles.
199+
200+
**Rationale**:
201+
- OpenESPI-Common is a **dependency library JAR**, not a standalone application
202+
- DataCustodian and ThirdParty are the **actual web applications** that need monitoring
203+
- Applications should control their own endpoint exposure and security
204+
- Monitoring requirements vary between DataCustodian (utility-facing) and ThirdParty (customer-facing)
205+
206+
**Implementation**:
207+
- OpenESPI-Common provides **basic management configuration** (disabled by default)
208+
- Applications should add their own actuator configuration:
209+
```yaml
210+
management:
211+
endpoints:
212+
web:
213+
exposure:
214+
include: health,info,metrics
215+
endpoint:
216+
health:
217+
show-details: when_authorized
218+
```
219+
220+
### Profile Responsibility Separation
221+
- **OpenESPI-Common**: Database, logging, ESPI-specific configuration
222+
- **DataCustodian**: Web endpoints, actuator, utility-specific monitoring
223+
- **ThirdParty**: Web endpoints, actuator, customer-specific monitoring
224+
225+
This migration provides a modern, scalable foundation for Spring Boot 3.5 deployment across all OpenESPI environments while maintaining backward compatibility with existing deployment scripts.

pom.xml

Lines changed: 86 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,31 +116,112 @@
116116
</properties>
117117

118118
<profiles>
119+
<!-- Legacy profile maintained for backward compatibility -->
119120
<profile>
120121
<id>dev</id>
121122
<activation>
122123
<activeByDefault>false</activeByDefault>
123124
</activation>
124125
<properties>
125-
<profile>dev</profile>
126-
<database>hsql</database>
126+
<spring.profiles.active>local</spring.profiles.active>
127+
<profile>local</profile>
128+
<database>h2</database>
127129
</properties>
128130
</profile>
131+
132+
<!-- Modern Spring Boot 3.5 profiles -->
129133
<profile>
130-
<id>devmysql</id>
134+
<id>dev-mysql</id>
131135
<activation>
132136
<activeByDefault>true</activeByDefault>
133137
</activation>
134138
<properties>
135-
<profile>devmysql</profile>
139+
<spring.profiles.active>dev-mysql</spring.profiles.active>
140+
<profile>dev-mysql</profile>
141+
<database>mysql</database>
142+
</properties>
143+
</profile>
144+
145+
<profile>
146+
<id>dev-postgresql</id>
147+
<activation>
148+
<activeByDefault>false</activeByDefault>
149+
</activation>
150+
<properties>
151+
<spring.profiles.active>dev-postgresql</spring.profiles.active>
152+
<profile>dev-postgresql</profile>
153+
<database>postgresql</database>
154+
</properties>
155+
</profile>
156+
157+
<profile>
158+
<id>local</id>
159+
<activation>
160+
<activeByDefault>false</activeByDefault>
161+
</activation>
162+
<properties>
163+
<spring.profiles.active>local</spring.profiles.active>
164+
<profile>local</profile>
165+
<database>h2</database>
166+
</properties>
167+
</profile>
168+
169+
<profile>
170+
<id>prod</id>
171+
<activation>
172+
<activeByDefault>false</activeByDefault>
173+
</activation>
174+
<properties>
175+
<spring.profiles.active>prod</spring.profiles.active>
176+
<profile>prod</profile>
177+
<database>mysql</database>
178+
</properties>
179+
</profile>
180+
181+
<profile>
182+
<id>docker</id>
183+
<activation>
184+
<activeByDefault>false</activeByDefault>
185+
</activation>
186+
<properties>
187+
<spring.profiles.active>docker</spring.profiles.active>
188+
<profile>docker</profile>
189+
<database>mysql</database>
190+
</properties>
191+
</profile>
192+
193+
<profile>
194+
<id>aws-sandbox</id>
195+
<activation>
196+
<activeByDefault>false</activeByDefault>
197+
</activation>
198+
<properties>
199+
<spring.profiles.active>aws-sandbox</spring.profiles.active>
200+
<profile>aws-sandbox</profile>
201+
<database>mysql</database>
202+
</properties>
203+
</profile>
204+
205+
<!-- Legacy profile maintained for backward compatibility -->
206+
<profile>
207+
<id>devmysql</id>
208+
<activation>
209+
<activeByDefault>false</activeByDefault>
210+
</activation>
211+
<properties>
212+
<spring.profiles.active>dev-mysql</spring.profiles.active>
213+
<profile>dev-mysql</profile>
136214
<database>mysql</database>
137215
</properties>
138216
</profile>
217+
218+
<!-- Legacy profile maintained for backward compatibility -->
139219
<profile>
140220
<!-- Green Button Alliance AWS Green Button Sandbox -->
141221
<id>awsgbasandbox</id>
142222
<properties>
143-
<profile>awsgbasandbox</profile>
223+
<spring.profiles.active>aws-sandbox</spring.profiles.active>
224+
<profile>aws-sandbox</profile>
144225
<database>mysql</database>
145226
</properties>
146227
</profile>

0 commit comments

Comments
 (0)