Skip to content

Commit 81322fc

Browse files
feat: Issue 39 spring boot 4 and Java 25 upgrade (#50)
* #39 Update SubscriptionEntity to remove deprecated @TeMPOraL annotation and migrate Calendar type to LocalDateTime for consistency. * #39 Updates for removed annotations in Hibernate 7. * #39 Update properties for Jackson 3 * #39 Refactor type from Calendar to LocalDateTime for consistency and Hibernate 7 * #39 Add migration info for Spring Boot 4.0 * #39 Updates for Java 25 * #39 Updates for Java 25 * Refactor for deprecated method * Change to H2 supported datatype * #39, incremental, pre-openrewrite * Migrated remaining modules to Spring Boot 4/ Java 25 and updated dependencies. Refactored Maven build to remove duplication and improve consistency. Renamed project coordinates for consistency across modules. NOTE: Auth Server has been migrated to Spring Boot 4 / Spring Security 7, however there are failing tests unrelated to the upgrade. Spring Security does not support use of JWT and Opaque tokens concurrently. * Updated from upstream project, restored PostgresIT, added missing database column. * Truncate nanoseconds in timestamps for consistent tests across platforms.
1 parent 8cbe19c commit 81322fc

File tree

92 files changed

+1424
-1495
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+1424
-1495
lines changed

.github/CI_CD_SETUP.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ The project uses **GitHub Actions** for CI/CD with **SonarCloud** integration fo
1717
**Jobs:**
1818

1919
#### build-and-test
20-
- Runs on Ubuntu with Java 21
20+
- Runs on Ubuntu with Java 25
2121
- Sets up MySQL 8.0 and PostgreSQL 15 services
2222
- Builds all modules
2323
- Runs unit tests for each module separately (authserver temporarily excluded)

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
branches: [ main, develop ]
88

99
env:
10-
JAVA_VERSION: '21'
10+
JAVA_VERSION: '25'
1111
MAVEN_OPTS: -Xmx3072m
1212

1313
jobs:
@@ -48,7 +48,7 @@ jobs:
4848
with:
4949
fetch-depth: 0 # Shallow clones should be disabled for better SonarCloud analysis
5050

51-
- name: Set up JDK 21
51+
- name: Set up JDK 25
5252
uses: actions/setup-java@v4
5353
with:
5454
java-version: ${{ env.JAVA_VERSION }}
@@ -129,7 +129,7 @@ jobs:
129129
with:
130130
fetch-depth: 0 # Shallow clones should be disabled for better SonarCloud analysis
131131

132-
- name: Set up JDK 21
132+
- name: Set up JDK 25
133133
uses: actions/setup-java@v4
134134
with:
135135
java-version: ${{ env.JAVA_VERSION }}
@@ -173,7 +173,7 @@ jobs:
173173
- name: Checkout code
174174
uses: actions/checkout@v4
175175

176-
- name: Set up JDK 21
176+
- name: Set up JDK 25
177177
uses: actions/setup-java@v4
178178
with:
179179
java-version: ${{ env.JAVA_VERSION }}

.github/workflows/pr-checks.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
types: [opened, synchronize, reopened]
66

77
env:
8-
JAVA_VERSION: '21'
8+
JAVA_VERSION: '25'
99
MAVEN_OPTS: -Xmx3072m
1010

1111
jobs:
@@ -19,7 +19,7 @@ jobs:
1919
with:
2020
fetch-depth: 0
2121

22-
- name: Set up JDK 21
22+
- name: Set up JDK 25
2323
uses: actions/setup-java@v4
2424
with:
2525
java-version: ${{ env.JAVA_VERSION }}
@@ -66,7 +66,7 @@ jobs:
6666
with:
6767
fetch-depth: 0
6868

69-
- name: Set up JDK 21
69+
- name: Set up JDK 25
7070
uses: actions/setup-java@v4
7171
with:
7272
java-version: ${{ env.JAVA_VERSION }}

.junie/guidelines.md

Lines changed: 64 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
This is a complete monorepo implementation of the NAESB Energy Services Provider Interface (ESPI) 4.0 specification for Green Button energy data standards. The project provides OAuth2-based energy data exchange capabilities between utilities, third-party applications, and consumers.
66

77
**Key Technologies:**
8-
- Java 21 (LTS)
9-
- Spring Boot 3.5.0 (Jakarta EE 9+)
8+
- Java 25 (LTS)
9+
- Spring Boot 4.0.0
1010
- Maven 3.9+ multi-module build
1111
- OAuth2 authorization framework
1212
- Green Button energy data standards
@@ -138,4 +138,65 @@ When working on the project, be aware of the migration status:
138138
- When creating or updating tests, use the Junit `@DisplayName` annotation to provide a human readable name for the test. This will improve the quality of the test report.
139139
- When creating or updating tests, use the Junit `@Nested` annotation to group related tests. This will improve the readability of the test report.
140140
- When investigating test failures of transaction tests, verify the service implementation uses saveAndFlush() to save the entity. This will ensure the entity is saved to the database before the transaction is committed.
141-
- When testing persistence operations with JPA, do not set the id property. The Id property is set by Hibernate when the entity is saved to the database, and should not be set ahead of time.
141+
- When testing persistence operations with JPA, do not set the id property. The Id property is set by Hibernate when the entity is saved to the database, and should not be set ahead of time.
142+
143+
### Spring Boot 4.0 Updates and Deprecations
144+
- The `@MockBean` annotation is deprecated. Use `@MockitoBean` instead.
145+
- The `@SpyBean` annotation is deprecated. Use `@MockitoSpyBean` instead.
146+
- For `@WebMvcTest` the package to import has changed from `org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest` to `org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest`.
147+
- For `@DataJpaTest` the package to import has changed from `org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest` to `org.springframework.boot.data.jpa.test.autoconfigure.DataJpaTest`.
148+
- Using the `@SpringBootTest` annotation will no longer provide any MockMVC support. If you want to use MockMVC in your tests you should now add an `@AutoConfigureMockMvc` annotation to the test class.
149+
- Using the `@SpringBootTest` annotation will no longer provide any WebClient or TestRestTemplate beans. If you want to use a WebTestClient you should now add an `@AutoConfigureWebTestClient` annotation to the test class. If you want to use a TestRestTemplate you should add an `@AutoConfigureTestRestTemplate` annotation to the test class.
150+
- The `@PropertyMapping` annotation has been relocated from the `org.springframework.boot.test.autoconfigure.properties` package to `org.springframework.boot.test.context`.
151+
- The following Maven Dependency has been removed:
152+
```xml
153+
<dependency>
154+
<groupId>org.springframework.boot</groupId>
155+
<artifactId>spring-boot-starter-test</artifactId>
156+
<scope>test</scope>
157+
</dependency>
158+
```
159+
- For testing Spring MVC, the following Maven Dependencies is required:
160+
```xml
161+
<dependency>
162+
<groupId>org.springframework.boot</groupId>
163+
<artifactId>spring-boot-starter-webmvc-test</artifactId>
164+
<scope>test</scope>
165+
</dependency>
166+
```
167+
- For testing Spring Data JPA, the following Maven Dependencies is required:
168+
```xml
169+
<dependency>
170+
<groupId>org.springframework.boot</groupId>
171+
<artifactId>spring-boot-starter-data-jpa-test</artifactId>
172+
<scope>test</scope>
173+
</dependency>
174+
```
175+
- For testing Bean Validation, the following Maven Dependencies is required:
176+
```xml
177+
<dependency>
178+
<groupId>org.springframework.boot</groupId>
179+
<artifactId>spring-boot-starter-validation-test</artifactId>
180+
<scope>test</scope>
181+
</dependency>
182+
```
183+
- The Maven Dependency for TestContainers has changed from:
184+
```xml
185+
<dependency>
186+
<groupId>org.testcontainers</groupId>
187+
<artifactId>junit-jupiter</artifactId>
188+
<scope>test</scope>
189+
</dependency>
190+
```
191+
to:
192+
```xml
193+
<dependency>
194+
<groupId>org.testcontainers</groupId>
195+
<artifactId>testcontainers-junit-jupiter</artifactId>
196+
<scope>test</scope>
197+
</dependency>
198+
```
199+
200+
201+
202+

README.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Complete monorepo implementation of the NAESB Energy Services Provider Interface
99
git clone https://github.com/GreenButtonAlliance/OpenESPI-GreenButton-Java.git
1010
cd OpenESPI-GreenButton-Java
1111

12-
# Build all modules (Java 21 + Jakarta EE throughout)
12+
# Build all modules (Java 25 + Jakarta EE throughout)
1313
mvn clean install
1414

1515
# Run Spring Boot 3.5 modules
@@ -21,26 +21,25 @@ cd openespi-authserver && mvn spring-boot:run
2121

2222
| Module | Description | Java | Jakarta EE | Spring Boot | Status |
2323
|--------|-------------|------|------------|-------------|--------|
24-
| **openespi-common** | Shared domain models, services | 21| 9+| 3.5.0 ✅ | **Production** |
25-
| **openespi-datacustodian** | OAuth2 resource server | 21| 9+| 3.5.0 ✅ | **Production** |
26-
| **openespi-authserver** | OAuth2 authorization server | 21| 9+| 3.5.0 ✅ | **Production** |
27-
| **openespi-thirdparty** | Client application | 21| 9+ ✅ | 4.0.6 ⚠️ | **Partial Migration** |
24+
| **openespi-common** | Shared domain models, services | 25| 11 | 4.0.1 ✅ | **Production** |
25+
| **openespi-datacustodian** | OAuth2 resource server | 25| 11 | 4.0.1 ✅ | **Production** |
26+
| **openespi-authserver** | OAuth2 authorization server | 25| 11 | 4.0.1 ✅ | **Production** |
27+
| **openespi-thirdparty** | Client application | 25| | 4.0.1 ⚠️ | **Partial Migration** |
2828

2929
## 🏗️ Architecture
3030

3131
```
3232
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
3333
│ Third Party │───▶│ Authorization │───▶│ Data Custodian │
34-
│ (Java 21+Jakarta)│ │ Server (SB 3.5) │ │ Server (SB 3.5) │
35-
│ │ │ (Independent) │ │ │
34+
│(Java 25+Jakarta)│ │ Server (SB 4.0) │ │ Server (SB 4.0) │
3635
└─────────────────┘ └─────────────────┘ └─────────────────┘
3736
│ │
3837
│ │
3938
└──────────────────────────────────────────────┘
4039
4140
┌─────────────────┐
4241
│ OpenESPI Common │
43-
(Spring Boot 3.5)│
42+
│(Spring Boot 4.0)│
4443
└─────────────────┘
4544
```
4645

@@ -53,30 +52,30 @@ cd openespi-authserver && mvn spring-boot:run
5352
## ✨ Migration Achievements
5453

5554
**All modules now support:**
56-
-**Java 21** - Modern JVM with performance improvements
57-
-**Jakarta EE 9+** - Modern enterprise Java APIs
55+
-**Java 25** - Modern JVM with performance improvements
56+
-**Jakarta EE 11+** - Modern enterprise Java APIs
5857
-**Consistent build system** - Maven 3.9+ throughout
5958

60-
**Spring Boot 3.5 modules:**
59+
**Spring Boot 4.0 modules:**
6160
-**openespi-common** - Foundation library
6261
-**openespi-datacustodian** - Resource server
6362
-**openespi-authserver** - Authorization server
6463

6564
**Partially migrated:**
66-
- ⚠️ **openespi-thirdparty** - Java 21 + Jakarta ready, Spring Boot migration in progress
65+
- ⚠️ **openespi-thirdparty** - Java 25 + Jakarta ready, Spring Boot migration in progress
6766

6867
## 🛠️ Development
6968

7069
### All Modules (Recommended)
7170
```bash
72-
# Build everything - all modules are Java 21 compatible
71+
# Build everything - all modules are Java 25 compatible
7372
mvn clean install
7473

7574
# Test specific module
7675
mvn test -pl openespi-datacustodian -am
7776
```
7877

79-
### Spring Boot 3.5 Only
78+
### Spring Boot 4.0 Only
8079
```bash
8180
# Build only fully-migrated modules
8281
mvn clean install -Pspring-boot-only
@@ -105,13 +104,13 @@ mvn spring-boot:run
105104
The ThirdParty module preserves important migration work from the main branch:
106105

107106
**✅ Completed (from main branch):**
108-
- Java 1.7 → Java 21 upgrade
107+
- Java 1.7 → Java 25 upgrade
109108
- javax.servlet → jakarta.servlet migration
110109
- JSP/JSTL Jakarta compatibility
111110
- Modern Maven toolchain
112111

113112
**📝 Next Steps:**
114-
- Spring Framework → Spring Boot 3.5 migration
113+
- Spring Framework → Spring Boot 4.0 migration
115114
- OAuth2 client modernization
116115
- Configuration externalization
117116

@@ -299,6 +298,6 @@ Licensed under the Apache License 2.0. See [LICENSE](./LICENSE) for details.
299298

300299
---
301300

302-
**Migration Strategy:** All modules use `main` branches to preserve maximum migration work and ensure Java 21 + Jakarta EE consistency across the ecosystem.
301+
**Migration Strategy:** All modules use `main` branches to preserve maximum migration work and ensure Java 25 + Jakarta EE consistency across the ecosystem.
303302

304303
**Built with ❤️ by the Green Button Alliance community**

0 commit comments

Comments
 (0)