Skip to content

Upgrade to Spring Boot 4.0.3, Java 25, Gradle 9.3.1 and modernize codebase#114

Open
dcaron wants to merge 2 commits intocloudfoundry-samples:masterfrom
dcaron:upgrade-spring-boot-4-java-25
Open

Upgrade to Spring Boot 4.0.3, Java 25, Gradle 9.3.1 and modernize codebase#114
dcaron wants to merge 2 commits intocloudfoundry-samples:masterfrom
dcaron:upgrade-spring-boot-4-java-25

Conversation

@dcaron
Copy link

@dcaron dcaron commented Feb 27, 2026

Summary

This PR brings the app up to the current latest stack while preserving its core purpose: demoing the same Spring Boot application on multiple database backends (H2, MySQL, PostgreSQL, MongoDB, Redis) on Cloud Foundry.

Backend / Build

  • Spring Boot 3.1.5 → 4.0.3, Java CFEnv 3.1.2 → 4.0.0
  • Java 17 → 25, Gradle 7.6.2 → 9.3.1
  • Remove io.spring.dependency-management plugin — Spring Boot 4's Gradle plugin manages the BOM natively
  • Update Spring Boot 4 auto-configuration package names in SpringApplicationContextInitializer (boot.data.*, boot.jdbc.*, boot.mongodb.*)
  • Switch logger from Apache Commons Logging to SLF4J
  • Replace Collections.singletonList/Map with List.of / Map.of
  • Replace deprecated @GenericGenerator + @GeneratedValue with @UuidGenerator (Hibernate 6 native; same UUID behaviour)
  • Fix Hibernate dialects: MySQL55DialectMySQLDialect, ProgressDialect (broken) → PostgreSQLDialect
  • Fix MySQL JDBC driver: com.mysql.jdbc.Drivercom.mysql.cj.jdbc.Driver
  • Replace Jackson2ResourceReader (removed in Spring Data 3) with direct ObjectMapper.readValue in AlbumRepositoryPopulator
  • Replace Jackson2JsonRedisSerializer (removed) with a custom RedisSerializer backed by Jackson 3 (tools.jackson) in RedisConfig
  • Migrate tests from JUnit 4 (@RunWith) to JUnit 5; add useJUnitPlatform()
  • Replace @RequestMapping(method=RequestMethod.*) with @GetMapping, @PostMapping, @PutMapping, @DeleteMapping
  • Replace manual convertIterableToList() with StreamSupport.stream().toList()
  • Update manifest.yml: explicit java_buildpack_offline, bump JRE to 25.+

Frontend (WebJars)

Library Before After
AngularJS 1.2.16 1.8.3 (final 1.x release)
Bootstrap 3.1.1 3.4.1 (final Bootstrap 3 patch)
jQuery 2.1.0 3.7.1 (security update)
angular-ui-bootstrap 0.10.0 0.14.3 (final 0.x; $modal API unchanged)
angular-ui 0.4.0-2 0.4.0-3

AngularJS is kept at 1.x and Bootstrap at 3.x to avoid breaking the existing templates and $modal-based album form.

Test plan

  • ./gradlew clean test passes (JUnit 5, H2 in-memory)
  • cf push + PostgreSQL service bound → 29 albums loaded, CRUD works, health UP
  • cf push + MySQL service bound → 29 albums loaded, health reports MySQL UP
  • cf push + Redis service bound → 29 albums loaded, health reports redis UP
  • Verify MongoDB backend (service not available in test environment)

Tested on TAS (Tanzu Application Service) with java_buildpack_offline v4.86.0 and OpenJDK JRE 25.0.1.

🤖 Generated with Claude Code

dcaron and others added 2 commits February 27, 2026 15:34
…ebase

Backend / build:
- Upgrade Spring Boot 3.1.5 → 4.0.3 and Java CFEnv 3.1.2 → 4.0.0
- Upgrade Java 17 → 25 and Gradle 7.6.2 → 9.3.1
- Remove io.spring.dependency-management plugin (Spring Boot 4 Gradle plugin
  handles the BOM natively)
- Update Spring Boot 4 auto-configuration class names in
  SpringApplicationContextInitializer (boot.data.*, boot.jdbc.*, boot.mongodb.*)
- Switch logger from Apache Commons Logging to SLF4J
- Replace Collections.singletonList/Map with List.of/Map.of
- Replace deprecated @GenericGenerator + @GeneratedValue with @uuidgenerator
  (Hibernate 6 native API; same UUID behaviour)
- Fix Hibernate dialects: MySQL55Dialect → MySQLDialect,
  ProgressDialect → PostgreSQLDialect
- Fix MySQL JDBC driver class: com.mysql.jdbc.Driver → com.mysql.cj.jdbc.Driver
- Replace Jackson2ResourceReader (removed in Spring Data 3) with direct
  ObjectMapper.readValue in AlbumRepositoryPopulator
- Replace Jackson2JsonRedisSerializer (removed) with a custom RedisSerializer
  backed by Jackson 3 (tools.jackson) in RedisConfig
- Migrate tests from JUnit 4 (@RunWith) to JUnit 5; add useJUnitPlatform()
- Replace @RequestMapping(method=RequestMethod.*) with @GetMapping,
  @PostMapping, @PutMapping, @DeleteMapping in AlbumController
- Replace manual convertIterableToList() with StreamSupport.stream().toList()
- Update manifest.yml: add java_buildpack_offline, bump JRE to 25.+

Frontend (WebJars):
- AngularJS 1.2.16 → 1.8.3 (final 1.x release)
- Bootstrap 3.1.1 → 3.4.1 (final Bootstrap 3 patch)
- jQuery 2.1.0 → 3.7.1 (security update)
- angular-ui-bootstrap 0.10.0 → 0.14.3 (final 0.x; $modal API unchanged)
- angular-ui 0.4.0-2 → 0.4.0-3

Tested on Cloud Foundry (TAS) with PostgreSQL, MySQL, and Redis backends.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Update Java requirement 17 → 25
- Add tech stack version table (Java 25, Spring Boot 4.0.3, Gradle 9.3.1, Java CFEnv 4.0.0)
- Fix all http:// links to https:// and update stale Spring Boot doc URLs
- Update Oracle driver instructions: compile → implementation (Gradle modern syntax)
- Update "Alternate Java versions" section to reference VERSION_25
- Minor wording fixes (its, H2 in-memory, cloudfoundry.org URL)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant