diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..48005ce
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -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
diff --git a/.gitignore b/.gitignore
index 57f1cb2..aef0a14 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,5 @@
-/.idea/
\ No newline at end of file
+/.idea/
+target/
+build/
+.gradle/
+*.class
diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties
index c954cec..75249eb 100644
--- a/.mvn/wrapper/maven-wrapper.properties
+++ b/.mvn/wrapper/maven-wrapper.properties
@@ -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
diff --git a/MIGRATION_NOTES.md b/MIGRATION_NOTES.md
new file mode 100644
index 0000000..b48963e
--- /dev/null
+++ b/MIGRATION_NOTES.md
@@ -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, `11`, `-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 `pom`, 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 `1.8` with
+ `maven.compiler.release=11` plus UTF-8 source/reporting encoding.
+- Added explicit, JDK-11-compatible plugin versions:
+ `maven-compiler-plugin` 3.11.0 (`11`, `-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+).
diff --git a/README.md b/README.md
index 2b09400..85897f3 100644
--- a/README.md
+++ b/README.md
@@ -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
@@ -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:
diff --git a/build.gradle b/build.gradle
index 09f1083..c164da4 100644
--- a/build.gradle
+++ b/build.gradle
@@ -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")
+}
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index a2ff3cc..ddfac6f 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -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
diff --git a/gradlew b/gradlew
old mode 100644
new mode 100755
diff --git a/mvnw b/mvnw
old mode 100644
new mode 100755
diff --git a/pom.xml b/pom.xml
index 63f5cbd..89d5894 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
org.springframework
gs-spring-boot
- pom
+ jar
0.1.0
@@ -32,19 +32,84 @@
com.h2database
h2
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
- 1.8
+ 11
+ UTF-8
+ UTF-8
-
org.springframework.boot
spring-boot-maven-plugin
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.11.0
+
+ 11
+
+ -Xlint:all
+ -Werror
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 3.2.5
+
+
+ org.apache.maven.plugins
+ maven-failsafe-plugin
+ 3.2.5
+
+
+
+ integration-test
+ verify
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 3.6.3
+
+ none
+ -Xdoclint:none
+
+
+
+ org.apache.maven.plugins
+ maven-enforcer-plugin
+ 3.5.0
+
+
+ enforce-java-11
+
+ enforce
+
+
+
+
+ [11,)
+
+
+
+
+
+
diff --git a/target/classes/hello/Application.class b/target/classes/hello/Application.class
deleted file mode 100644
index 245a020..0000000
Binary files a/target/classes/hello/Application.class and /dev/null differ
diff --git a/target/classes/hello/controller/GreetingController.class b/target/classes/hello/controller/GreetingController.class
deleted file mode 100644
index 1149660..0000000
Binary files a/target/classes/hello/controller/GreetingController.class and /dev/null differ
diff --git a/target/classes/hello/controller/HelloController.class b/target/classes/hello/controller/HelloController.class
deleted file mode 100644
index 79b82ce..0000000
Binary files a/target/classes/hello/controller/HelloController.class and /dev/null differ
diff --git a/target/classes/hello/controller/TopicController.class b/target/classes/hello/controller/TopicController.class
deleted file mode 100644
index c32cad5..0000000
Binary files a/target/classes/hello/controller/TopicController.class and /dev/null differ
diff --git a/target/classes/hello/declaration/CustomPredicate.class b/target/classes/hello/declaration/CustomPredicate.class
deleted file mode 100644
index e35803f..0000000
Binary files a/target/classes/hello/declaration/CustomPredicate.class and /dev/null differ
diff --git a/target/classes/hello/declaration/TimeClient.class b/target/classes/hello/declaration/TimeClient.class
deleted file mode 100644
index a077c3b..0000000
Binary files a/target/classes/hello/declaration/TimeClient.class and /dev/null differ
diff --git a/target/classes/hello/model/Customer.class b/target/classes/hello/model/Customer.class
deleted file mode 100644
index 06e7307..0000000
Binary files a/target/classes/hello/model/Customer.class and /dev/null differ
diff --git a/target/classes/hello/model/Greeting.class b/target/classes/hello/model/Greeting.class
deleted file mode 100644
index f875277..0000000
Binary files a/target/classes/hello/model/Greeting.class and /dev/null differ
diff --git a/target/classes/hello/model/Quote.class b/target/classes/hello/model/Quote.class
deleted file mode 100644
index 3ec6c6c..0000000
Binary files a/target/classes/hello/model/Quote.class and /dev/null differ
diff --git a/target/classes/hello/model/SimpleTimeClient.class b/target/classes/hello/model/SimpleTimeClient.class
deleted file mode 100644
index f9bdddd..0000000
Binary files a/target/classes/hello/model/SimpleTimeClient.class and /dev/null differ
diff --git a/target/classes/hello/model/Topic.class b/target/classes/hello/model/Topic.class
deleted file mode 100644
index 3a53aa5..0000000
Binary files a/target/classes/hello/model/Topic.class and /dev/null differ
diff --git a/target/classes/hello/model/Value.class b/target/classes/hello/model/Value.class
deleted file mode 100644
index 862a68f..0000000
Binary files a/target/classes/hello/model/Value.class and /dev/null differ
diff --git a/target/classes/hello/service/TopicService.class b/target/classes/hello/service/TopicService.class
deleted file mode 100644
index b9f4992..0000000
Binary files a/target/classes/hello/service/TopicService.class and /dev/null differ
diff --git a/target/classes/public/index.html b/target/classes/public/index.html
deleted file mode 100644
index 566549b..0000000
--- a/target/classes/public/index.html
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
- Title
-
-
-
-
-
\ No newline at end of file