|
| 1 | +# Migration Notes: Java 8 → Java 11 |
| 2 | + |
| 3 | +## Java Version Change |
| 4 | + |
| 5 | +- **Source**: Java 8 (1.8) |
| 6 | +- **Target**: Java 11 |
| 7 | + |
| 8 | +Java 11 is a Long-Term Support (LTS) release that introduces improvements such as local-variable type inference (`var`), new String methods, HTTP Client API, and enhanced garbage collection. All existing Java 8 features (Streams, Lambdas, NIO, Optional, LocalDateTime) remain fully compatible. |
| 9 | + |
| 10 | +## Spring Boot Version Upgrade |
| 11 | + |
| 12 | +- **From**: Spring Boot 2.0.2.RELEASE |
| 13 | +- **To**: Spring Boot 2.7.18 |
| 14 | + |
| 15 | +Spring Boot 2.7.x is the final 2.x LTS line and provides full Java 11 support, along with security patches, dependency updates, and improved auto-configuration. |
| 16 | + |
| 17 | +## Build Tool Changes |
| 18 | + |
| 19 | +### Maven (`pom.xml`) |
| 20 | + |
| 21 | +- `<java.version>` changed from `1.8` to `11` |
| 22 | +- Added `<maven.compiler.release>11</maven.compiler.release>` |
| 23 | +- Added `<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>` |
| 24 | +- Changed `<packaging>` from `pom` to `jar` |
| 25 | +- Spring Boot parent version updated to `2.7.18` |
| 26 | + |
| 27 | +### Gradle (`build.gradle`) |
| 28 | + |
| 29 | +- `sourceCompatibility` changed from `1.8` to `JavaVersion.VERSION_11` |
| 30 | +- `targetCompatibility` changed from `1.8` to `JavaVersion.VERSION_11` |
| 31 | +- Spring Boot Gradle plugin updated to `2.7.18` |
| 32 | +- Replaced deprecated `compile` configuration with `implementation` |
| 33 | +- Replaced deprecated `testCompile` configuration with `testImplementation` |
| 34 | +- Added `spring-boot-starter-jdbc` and `h2` dependencies to match Maven |
| 35 | + |
| 36 | +## Plugin Upgrades |
| 37 | + |
| 38 | +| Plugin | Version | Purpose | |
| 39 | +|--------|---------|---------| |
| 40 | +| `maven-compiler-plugin` | 3.11.0 | Compiles with `--release 11` flag | |
| 41 | +| `maven-surefire-plugin` | 3.2.5 | Runs unit tests | |
| 42 | +| `maven-failsafe-plugin` | 3.2.5 | Runs integration tests | |
| 43 | +| `maven-enforcer-plugin` | 3.5.0 | Enforces minimum Java 11 at build time | |
| 44 | + |
| 45 | +## New Test Coverage |
| 46 | + |
| 47 | +- **`ApplicationTests.java`**: Spring Boot integration test verifying the application context loads successfully. |
| 48 | +- **`TopicControllerTest.java`**: MockMvc-based tests for all REST endpoints (`GET /topic`, `POST /topic`, `PUT /topic/{id}`, `DELETE /topic/{id}`, `GET /`, `GET /datetime`, etc.). |
| 49 | +- **`TopicServiceTest.java`**: Unit tests for service-layer methods covering Stream operations, NIO file methods, String processing, sorting, and filtering. |
| 50 | + |
| 51 | +## CI Workflow Added |
| 52 | + |
| 53 | +A GitHub Actions CI workflow (`.github/workflows/ci.yml`) was added: |
| 54 | +- Triggers on push and pull request to `main` |
| 55 | +- Uses `actions/setup-java@v4` with Temurin JDK 11 |
| 56 | +- Caches Maven dependencies |
| 57 | +- Runs `mvn -B clean verify` and `mvn -B test` |
0 commit comments