-
Notifications
You must be signed in to change notification settings - Fork 1
Upgrade springboot-java8 to Java 17 LTS #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| name: Build | ||
| on: [push, pull_request] | ||
| jobs: | ||
| maven: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: temurin | ||
| java-version: '17' | ||
| cache: maven | ||
| - run: mvn -B -V clean package | ||
| gradle: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: temurin | ||
| java-version: '17' | ||
| - uses: gradle/actions/setup-gradle@v3 | ||
| - run: ./gradlew -V clean bootJar | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📝 Info: Gradle CI job only builds bootJar, so test compilation is never exercised The Maven job runs Was this helpful? React with 👍 or 👎 to provide feedback. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The workflow content is specified for this upgrade, and the repo has no test sources at all (surefire logs |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip | ||
| distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,21 +5,16 @@ | |
|
|
||
| <groupId>org.springframework</groupId> | ||
| <artifactId>gs-spring-boot</artifactId> | ||
| <packaging>pom</packaging> | ||
| <packaging>jar</packaging> | ||
| <version>0.1.0</version> | ||
|
|
||
| <parent> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-starter-parent</artifactId> | ||
| <version>2.0.2.RELEASE</version> | ||
| <version>2.7.18</version> | ||
| </parent> | ||
|
|
||
| <dependencies> | ||
| <dependency> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-properties-migrator</artifactId> | ||
| <scope>runtime</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-starter-web</artifactId> | ||
|
|
@@ -32,15 +27,31 @@ | |
| <groupId>com.h2database</groupId> | ||
| <artifactId>h2</artifactId> | ||
| </dependency> | ||
|
Comment on lines
27
to
29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📝 Info: Maven and Gradle builds differ in H2 dependency scope
Was this helpful? React with 👍 or 👎 to provide feedback. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Leaving Maven at compile scope for now — this PR is scoped to the JDK 17 / Boot 2.7.18 upgrade and both builds package H2 identically today. Worth aligning in a follow-up. |
||
| <dependency> | ||
| <groupId>javax.annotation</groupId> | ||
| <artifactId>javax.annotation-api</artifactId> | ||
| <version>1.3.2</version> | ||
| </dependency> | ||
|
Comment on lines
+30
to
+34
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📝 Info: Unused javax.annotation-api dependency pinned in both builds No source file under Was this helpful? React with 👍 or 👎 to provide feedback. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| </dependencies> | ||
|
|
||
| <properties> | ||
| <java.version>1.8</java.version> | ||
| <java.version>17</java.version> | ||
| <maven.compiler.release>17</maven.compiler.release> | ||
| <maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version> | ||
| <maven-surefire-plugin.version>3.5.6</maven-surefire-plugin.version> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔍 surefire version property is declared but no plugin pins it
Was this helpful? React with 👍 or 👎 to provide feedback. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Confirmed: surefire 3.5.6 resolves and runs under the 2.7.18 parent — the verified build logs |
||
| </properties> | ||
|
|
||
|
|
||
| <build> | ||
| <plugins> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-compiler-plugin</artifactId> | ||
| <version>${maven-compiler-plugin.version}</version> | ||
| <configuration> | ||
| <release>${maven.compiler.release}</release> | ||
| </configuration> | ||
| </plugin> | ||
| <plugin> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-maven-plugin</artifactId> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,11 +17,13 @@ | |
| import org.springframework.context.annotation.Bean; | ||
| import org.springframework.jdbc.core.JdbcTemplate; | ||
| import org.springframework.web.client.RestTemplate; | ||
| import org.springframework.web.client.RestClientException; | ||
|
|
||
| @SpringBootApplication | ||
| public class Application implements CommandLineRunner { | ||
|
|
||
| private static final Logger log = LoggerFactory.getLogger(Application.class); | ||
| private static final String QUOTERS_URL = "http://gturnquist-quoters.cfapps.io/api/random"; | ||
|
|
||
| public static void main(String[] args) { | ||
|
|
||
|
|
@@ -36,8 +38,7 @@ public static void main(String[] args) { | |
| } | ||
|
|
||
| RestTemplate restTemplate = new RestTemplate(); | ||
|
Comment on lines
38
to
40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📝 Info: Quote is still fetched twice on startup
Was this helpful? React with 👍 or 👎 to provide feedback. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Intentional — calling the quote fetch from both |
||
| Quote quote = restTemplate.getForObject("http://gturnquist-quoters.cfapps.io/api/random", Quote.class); | ||
| log.info(quote.toString()); | ||
| logRandomQuote(restTemplate); | ||
| } | ||
|
|
||
|
|
||
|
|
@@ -49,12 +50,23 @@ public RestTemplate restTemplate(RestTemplateBuilder builder) { | |
| @Bean | ||
| public CommandLineRunner run(RestTemplate restTemplate) throws Exception { | ||
| return args -> { | ||
| Quote quote = restTemplate.getForObject( | ||
| "http://gturnquist-quoters.cfapps.io/api/random", Quote.class); | ||
| log.info(quote.toString()); | ||
| logRandomQuote(restTemplate); | ||
| }; | ||
| } | ||
|
|
||
| private static void logRandomQuote(RestTemplate restTemplate) { | ||
| try { | ||
| Quote quote = restTemplate.getForObject(QUOTERS_URL, Quote.class); | ||
| if (quote == null) { | ||
| log.warn("Unable to retrieve random quote from {}", QUOTERS_URL); | ||
| } else { | ||
| log.info(quote.toString()); | ||
| } | ||
| } catch (RestClientException ex) { | ||
| log.warn("Unable to retrieve random quote from {}", QUOTERS_URL, ex); | ||
| } | ||
| } | ||
|
devin-ai-integration[bot] marked this conversation as resolved.
|
||
|
|
||
|
|
||
| @Autowired | ||
| JdbcTemplate jdbcTemplate; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Info: Gradle CI job skips dependency caching that the Maven job enables
The maven job sets
cache: mavenon setup-java, but the gradle job relies solely ongradle/actions/setup-gradle@v3. That action does provide Gradle caching by default, so this is not broken, but the asymmetry (nocache: gradleon setup-java) is worth noting if build time matters.Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Intentional:
gradle/actions/setup-gradle@v3already caches Gradle dependencies, so addingcache: gradleto setup-java would be redundant.