Skip to content

Commit 4a6110a

Browse files
committed
upgrade java project to spring boot 4.0
1 parent b845ed7 commit 4a6110a

File tree

11 files changed

+131
-28
lines changed

11 files changed

+131
-28
lines changed

.devcontainer/java/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Java",
3-
"image": "mcr.microsoft.com/devcontainers/java:21-bullseye",
3+
"image": "mcr.microsoft.com/devcontainers/java:25-jdk-bookworm",
44
"containerEnv": {
55
"DISABLE_JAVA_BUILD": "true"
66
},

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ localstack/data
33
.mypy_cache
44
target
55
.idea
6-
postgres-data
6+
postgres-data
7+
.DS_Store

java/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Java Project
22

33
## Tech Stack
4-
- Java 21
5-
- JUnit 5
6-
- Spring Boot 3.2
4+
- Java 25
5+
- JUnit 6
6+
- Spring Boot 4.0
77
- Web
88
- JPA
99
- Lombok

java/build.gradle

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
plugins {
22
id 'java'
3-
id 'org.springframework.boot' version '3.2.0'
4-
id 'io.spring.dependency-management' version '1.1.4'
3+
id 'org.springframework.boot' version '4.0.0'
4+
id 'io.spring.dependency-management' version '1.1.7'
55
}
66

77
group = 'com.sourceallies'
88
version = '0.0.1-SNAPSHOT'
99

1010
java {
11-
sourceCompatibility = '21'
11+
toolchain {
12+
languageVersion = JavaLanguageVersion.of(25)
13+
}
1214
}
1315

1416
configurations {
@@ -23,17 +25,29 @@ repositories {
2325

2426
dependencies {
2527
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
26-
implementation 'org.springframework.boot:spring-boot-starter-web'
28+
implementation 'org.springframework.boot:spring-boot-starter-webmvc'
2729
compileOnly 'org.projectlombok:lombok'
2830
runtimeOnly 'org.postgresql:postgresql'
2931
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
3032
annotationProcessor 'org.projectlombok:lombok'
31-
testImplementation 'org.springframework.boot:spring-boot-starter-test'
33+
testImplementation 'org.springframework.boot:spring-boot-starter-data-jpa-test'
34+
testImplementation 'org.springframework.boot:spring-boot-starter-webmvc-test'
35+
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
3236
}
3337

3438
tasks.named('test') {
3539
useJUnitPlatform()
3640
testLogging {
37-
exceptionFormat "full"
41+
events = ["passed", "skipped", "failed"]
42+
exceptionFormat = "full"
43+
showExceptions = true
44+
showCauses = true
45+
showStackTraces = true
46+
}
47+
afterSuite { desc, result ->
48+
if (!desc.parent) {
49+
println "\nTest Results: ${result.resultType}"
50+
println "Tests run: ${result.testCount}, Passed: ${result.successfulTestCount}, Failed: ${result.failedTestCount}, Skipped: ${result.skippedTestCount}"
51+
}
3852
}
3953
}

java/gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
org.gradle.configuration-cache=true
2.13 KB
Binary file not shown.

java/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

java/gradlew

Lines changed: 7 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

java/gradlew.bat

Lines changed: 93 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

java/src/main/java/com/sourceallies/interview/Solution.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
package com.sourceallies.interview;
22

3-
import org.springframework.web.bind.annotation.GetMapping;
4-
import org.springframework.web.bind.annotation.RestController;
5-
6-
@RestController
73
public class Solution {
8-
9-
@GetMapping
4+
105
public String getGreeting() {
116
return "Hello, world!";
127
}

0 commit comments

Comments
 (0)