Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: CI (JDK 11)

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
maven:
name: Maven build (Temurin 11)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '11'
cache: maven

- name: Build and verify
run: ./mvnw -B -e clean verify

gradle:
name: Gradle build (Temurin 11)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '11'
cache: gradle

- name: Build
run: ./gradlew --no-daemon clean build
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
/.idea/
/.idea/
target/
build/
.gradle/
*.class
3 changes: 2 additions & 1 deletion .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
wrapperUrl=https://repo1.maven.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar
110 changes: 110 additions & 0 deletions MIGRATION_NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# Java 8 → Java 11 Migration Notes

This document summarizes the migration of `springboot-java8` from Java 8 to
**Java 11 (LTS)**. The goal was a minimal, behavior-preserving migration: upgrade
the build toolchain and CI to JDK 11, replace anything removed from the JDK, and
keep the application code unchanged.

## Summary

| Area | Before | After |
| --- | --- | --- |
| Java language/runtime target | 8 (`java.version=1.8`) | 11 (`maven.compiler.release=11`) |
| Maven packaging | `pom` (sources never compiled) | `jar` (sources compiled + repackaged) |
| Maven wrapper | 3.3.9 | 3.9.9 |
| maven-compiler-plugin | inherited 3.7.0 | 3.11.0, `<release>11</release>`, `-Xlint:all -Werror` |
| maven-surefire-plugin | inherited 2.21.0 | 3.2.5 |
| maven-failsafe-plugin | not configured | 3.2.5 |
| maven-javadoc-plugin | not configured | 3.6.3, doclint disabled |
| maven-enforcer-plugin | not configured | 3.5.0, `requireJavaVersion [11,)` |
| Gradle wrapper | 4.6 (does not run on JDK 11) | 6.9.4 |
| Gradle Java target | `sourceCompatibility = 1.8` | toolchain `languageVersion = 11` |
| CI | none | GitHub Actions, Temurin 11, Maven + Gradle |

## Baseline (Java 8)

A Java 8 baseline was captured before any changes:

- `JAVA_HOME` = Temurin/OpenJDK `1.8.0_492`
- `./mvnw -B clean package` → `BUILD SUCCESS`

Note: with the original `<packaging>pom</packaging>`, the Maven build never invoked
the compiler, so the "baseline" Maven build did not actually compile the `hello.*`
sources. The Gradle build was the only one that compiled code. This is called out
because it changes what "parity" means here (see below).

## Build tooling changes

### Maven (`pom.xml`)

- **`packaging` changed from `pom` to `jar`.** As a `pom` project the
`maven-compiler-plugin` and `maven-surefire-plugin` never ran, so the Java 11
`release` flag would have had no effect. Switching to `jar` makes Maven actually
compile the sources under `--release 11` and produce a runnable Spring Boot jar
via `spring-boot-maven-plugin:repackage`.
- Replaced `<java.version>1.8</java.version>` with
`maven.compiler.release=11` plus UTF-8 source/reporting encoding.
- Added explicit, JDK-11-compatible plugin versions:
`maven-compiler-plugin` 3.11.0 (`<release>11</release>`, `-Xlint:all`,
`-Werror`), `maven-surefire-plugin` 3.2.5, `maven-failsafe-plugin` 3.2.5,
`maven-javadoc-plugin` 3.6.3, `maven-enforcer-plugin` 3.5.0 enforcing
`requireJavaVersion [11,)`.
- Added `spring-boot-starter-test` (test scope) so the project has a standard test
source set; surefire reports `No tests to run` (the project ships no tests).
- Upgraded the Maven wrapper from 3.3.9 to 3.9.9 — the older plugin-aware tooling
(surefire/enforcer 3.x) requires Maven 3.6.3+.

### Gradle (`build.gradle`)

- Upgraded the Gradle wrapper from 4.6 to 6.9.4. Gradle 4.6 cannot run on JDK 11.
- Replaced `sourceCompatibility/targetCompatibility = 1.8` with a Java
**toolchain** pinned to `JavaLanguageVersion.of(11)`. (Gradle rejects combining a
project-level toolchain with `source/targetCompatibility`, so the latter were
removed.)
- Modernized the legacy `compile`/`testCompile` configurations to
`implementation`/`testImplementation`.
- **Parity fix:** added `spring-boot-starter-jdbc` and `com.h2database:h2`. The
original Gradle build only declared `spring-boot-starter-web`, so it failed to
compile `hello.Application` (which uses `JdbcTemplate`). These deps already
existed in `pom.xml`; adding them brings the Gradle build to parity with Maven.

## Removed JDK modules (Java EE / CORBA / JavaFX)

A scan of the source (`javax.xml.bind`, `javax.activation`, `javax.xml.ws`,
`com.sun.*`, `sun.misc.*`, Nashorn, `javafx.*`, CORBA / `org.omg.*`) found **no
usages**. No external replacement dependencies (JAXB, JAX-WS, JavaFX, Activation)
were required.

## Encapsulation / illegal reflective access

The application code triggers no illegal reflective access warnings when compiled
or packaged on JDK 11, so **no `--add-opens` flags were added**. The only reflective
access warning observed comes from Gradle 6.9.4's own Groovy runtime during the
build (not from application code); it disappears with a newer Gradle and is out of
scope for this behavior-preserving migration.

## Security / TLS, GC, logging

No code or configuration depends on TLS protocol/cipher pinning, keystore type, or
GC/JVM tuning flags (the only runtime config is the optional `server.port` in
`application.properties`). Java 11 defaults (TLS 1.3, PKCS12 keystores, G1 GC,
unified logging) therefore apply with no changes needed.

## Validation

- `./mvnw -B clean verify` on **JDK 11** → `BUILD SUCCESS` (compiles with
`-Xlint:all -Werror`, enforcer confirms Java 11, jar repackaged).
- `./gradlew --no-daemon clean build` on **JDK 11** → `BUILD SUCCESSFUL`.
- No compiler warnings under `-Xlint:all`.
- Coverage is unchanged (the project ships no tests, so coverage is 0% before and
after; CI is green on the build).

## Follow-ups (out of scope)

- Spring Boot 2.0.2 / Spring 5.0 predate official Java 11 support. Compilation and
packaging are clean on JDK 11, but a future PR should upgrade to Spring Boot
2.1+ (ideally 2.7.x) for fully supported Java 11 runtime behavior.
- Add an actual test suite (e.g. `@SpringBootTest`) so CI verifies runtime
behavior, not just compilation.
- Resolve Gradle deprecation warnings by moving to Gradle 7/8 (requires the Spring
Boot upgrade above, since the 2.0.2 Gradle plugin is incompatible with Gradle 7+).
26 changes: 22 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# springboot-java8

> **Now builds and runs on Java 11 (LTS).** The build toolchain and CI target
> JDK 11. See [`MIGRATION_NOTES.md`](MIGRATION_NOTES.md) for migration details.

The project is made on spring boot. The project summarize the new features present in Java 8.
It contain list of harcoded topics list. You can call the apis's with POSTMAN to add,delete,update Topic list
In addition, it uses
Expand Down Expand Up @@ -76,20 +80,34 @@ GET /datetime

### Prerequisites

1) Java sdk
1) JDK 11 (e.g. Eclipse Temurin 11)
2) POSTMAN

### Installing



```
1) Download or clone
2) Import the project
3) Run on location machine
3) Run on local machine
4) Open Postman, to call API's ( localhost:8080 )
```

### Building & Running (JDK 11)

This project can be built with either Maven or Gradle. Both target Java 11.

Maven:
```
./mvnw clean verify # compile, run tests, build the jar
java -jar target/gs-spring-boot-0.1.0.jar
```

Gradle:
```
./gradlew clean build # compile, run tests, build the jar
java -jar build/libs/gs-spring-boot-0.1.0.jar
```


## Helpful Links
Spring:
Expand Down
18 changes: 13 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,19 @@ repositories {
mavenCentral()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8
java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}

dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
testCompile("junit:junit")
compileJava {
options.encoding = 'UTF-8'
}

dependencies {
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-jdbc")
runtimeOnly("com.h2database:h2")
testImplementation("junit:junit")
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 Gradle wrapper script lacks executable permission (pre-existing)

The gradlew script is tracked with git mode 100644 (not executable), while mvnw is correctly 100755. Running ./gradlew clean build on Linux/macOS would fail with a permission error unless chmod +x is applied first. This is a pre-existing issue (not introduced by this PR), but the PR does modify the Gradle wrapper properties and documents ./gradlew clean build as a valid build command in README.md:92, making it more likely someone will hit this.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in this branch — gradlew is now tracked with mode 100755 (executable), matching mvnw:

$ git ls-tree HEAD gradlew mvnw
100755 blob ... gradlew
100755 blob ... mvnw

The Gradle CI job (./gradlew --no-daemon clean build) runs the wrapper directly without a chmod step and passes, confirming the executable bit is set.

Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.4-bin.zip
Empty file modified gradlew
100644 → 100755
Empty file.
Empty file modified mvnw
100644 → 100755
Empty file.
71 changes: 68 additions & 3 deletions pom.xml

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 Spring Boot 2.0.2 predates official Java 11 support

The PR acknowledges this in MIGRATION_NOTES.md:104-106, but it's worth noting as a reviewer: Spring Boot 2.0.x was EOL before Java 11 GA. While the build compiles cleanly on JDK 11, runtime behavior (especially Spring Framework 5.0's reflection and proxy internals) may exhibit subtle issues on JDK 11+ that are fixed in Spring Boot 2.1+. The -Xlint:all -Werror flags and the enforcer plugin help catch compile-time issues, but they don't guard against runtime incompatibilities. The project currently has zero tests, so there's no runtime validation in CI.

(Refers to line 14)

Open in Devin Review (Staging)

Was this helpful? React with 👍 or 👎 to provide feedback.

Debug

Playground

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 Spring Boot 2.0.2 predates official JDK 11 support

The PR migrates to Java 11 but retains Spring Boot 2.0.2.RELEASE (pom.xml:14, build.gradle:6). Spring Boot 2.0.x / Spring Framework 5.0.x did not officially support JDK 11 — that was added in Spring Boot 2.1.x. While the build compiles and packages cleanly (as noted in MIGRATION_NOTES.md), there may be subtle runtime issues (e.g., reflection warnings, internal API usage) that only manifest at runtime under JDK 11. The PR author correctly documents this as a follow-up item in MIGRATION_NOTES.md:101-104, but reviewers should be aware this is a known gap in the migration.

(Refers to line 14)

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acknowledged and intentional. This PR is scoped to the Java 8 → 11 toolchain/CI migration with minimal behavior change, so the framework version is deliberately held at Spring Boot 2.0.2. It compiles, packages, and boots on JDK 11 (the Spring context starts; the only startup failure is a pre-existing call to a now-dead external quotes endpoint, identical on Java 8). The Spring Boot 2.1+/2.7.x upgrade for officially-supported JDK 11 runtime is called out as a follow-up in MIGRATION_NOTES.md and the PR description.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>org.springframework</groupId>
<artifactId>gs-spring-boot</artifactId>
<packaging>pom</packaging>
<packaging>jar</packaging>
<version>0.1.0</version>

<parent>
Expand All @@ -32,19 +32,84 @@
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<properties>
<java.version>1.8</java.version>
<maven.compiler.release>11</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>


<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<release>11</release>
Comment thread
staging-devin-ai-integration[bot] marked this conversation as resolved.
Resolved
<compilerArgs>
<arg>-Xlint:all</arg>
<arg>-Werror</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.2.5</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.6.3</version>
<configuration>
<doclint>none</doclint>
<additionalOptions>-Xdoclint:none</additionalOptions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.5.0</version>
<executions>
<execution>
<id>enforce-java-11</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireJavaVersion>
<version>[11,)</version>
</requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
Binary file removed target/classes/hello/Application.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed target/classes/hello/declaration/CustomPredicate.class
Binary file not shown.
Binary file removed target/classes/hello/declaration/TimeClient.class
Binary file not shown.
Binary file removed target/classes/hello/model/Customer.class
Binary file not shown.
Binary file removed target/classes/hello/model/Greeting.class
Binary file not shown.
Binary file removed target/classes/hello/model/Quote.class
Binary file not shown.
Binary file removed target/classes/hello/model/SimpleTimeClient.class
Binary file not shown.
Binary file removed target/classes/hello/model/Topic.class
Binary file not shown.
Binary file removed target/classes/hello/model/Value.class
Binary file not shown.
Binary file removed target/classes/hello/service/TopicService.class
Binary file not shown.
10 changes: 0 additions & 10 deletions target/classes/public/index.html

This file was deleted.

Loading