diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 50cb9ad..96a4017 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -7,8 +7,8 @@ repositories { } dependencies { - implementation("com.github.spotbugs.snom:spotbugs-gradle-plugin:6.1.7") - implementation("net.ltgt.gradle:gradle-errorprone-plugin:4.1.0") + implementation("com.github.spotbugs.snom:spotbugs-gradle-plugin:6.1.13") + implementation("net.ltgt.gradle:gradle-errorprone-plugin:4.2.0") implementation("info.solidsoft.gradle.pitest:gradle-pitest-plugin:1.15.0") implementation("org.gradle:test-retry-gradle-plugin:1.6.2") implementation("io.freefair.gradle:lombok-plugin:8.13.1") diff --git a/buildSrc/settings.gradle.kts b/buildSrc/settings.gradle.kts index 3bf1bef..8b2d1ca 100644 --- a/buildSrc/settings.gradle.kts +++ b/buildSrc/settings.gradle.kts @@ -1 +1,9 @@ rootProject.name = "java-experiments-conventions" + +dependencyResolutionManagement { + versionCatalogs { + create("libs") { + from(files("../gradle/libs.versions.toml")) + } + } +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..14f9445 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,8 @@ +[versions] +spring-boot-v3 = "3.5.0" + +[libraries] +spring-boot-v3-dependencies = { group = "org.springframework.boot", name = "spring-boot-dependencies", version.ref = "spring-boot-v3" } + +[plugins] +spring-boot-v3 = { id = "org.springframework.boot", version.ref = "spring-boot-v3" } diff --git a/internal-bom/build.gradle.kts b/internal-bom/build.gradle.kts index 11f6fca..1937c05 100644 --- a/internal-bom/build.gradle.kts +++ b/internal-bom/build.gradle.kts @@ -12,7 +12,7 @@ javaPlatform { dependencies { api(platform("org.junit:junit-bom:5.13.0")) api(platform("org.testcontainers:testcontainers-bom:1.21.1")) - api(platform("io.github.mfvanek:pg-index-health-bom:0.14.6")) + api(platform("io.github.mfvanek:pg-index-health-bom:0.15.0")) api(platform("org.mockito:mockito-bom:5.18.0")) api(platform("org.assertj:assertj-bom:3.27.3")) diff --git a/internal-spring-boot-3-bom/build.gradle.kts b/internal-spring-boot-3-bom/build.gradle.kts index 7e7b652..5541b8c 100644 --- a/internal-spring-boot-3-bom/build.gradle.kts +++ b/internal-spring-boot-3-bom/build.gradle.kts @@ -11,10 +11,9 @@ javaPlatform { dependencies { api(platform(project(":internal-bom"))) - val spring3Version = "3.3.10" - api(platform("org.springframework.boot:spring-boot-dependencies:$spring3Version")) + api(platform(libs.spring.boot.v3.dependencies)) constraints { - api("org.springframework.boot:spring-boot-gradle-plugin:$spring3Version") + api("org.springframework.boot:spring-boot-gradle-plugin:${libs.versions.spring.boot.v3.get()}") } } diff --git a/mongo-db-reactive-app-example/build.gradle.kts b/mongo-db-reactive-app-example/build.gradle.kts index bdf94a7..ac0b3aa 100644 --- a/mongo-db-reactive-app-example/build.gradle.kts +++ b/mongo-db-reactive-app-example/build.gradle.kts @@ -1,6 +1,6 @@ plugins { id("java-experiments.java-conventions") - id("org.springframework.boot") version "3.3.10" + alias(libs.plugins.spring.boot.v3) id("com.google.osdetector") version "1.7.3" } diff --git a/spring-boot-app-example/build.gradle.kts b/spring-boot-app-example/build.gradle.kts index 5182739..690b915 100644 --- a/spring-boot-app-example/build.gradle.kts +++ b/spring-boot-app-example/build.gradle.kts @@ -1,6 +1,6 @@ plugins { id("java-experiments.java-conventions") - id("org.springframework.boot") version "3.3.10" + alias(libs.plugins.spring.boot.v3) id("com.google.osdetector") version "1.7.3" } diff --git a/spring-boot-app-example/src/main/java/io/github/mfvanek/pg/cluster/dtos/EmployeeCreationRequest.java b/spring-boot-app-example/src/main/java/io/github/mfvanek/pg/cluster/dtos/EmployeeCreationRequest.java index c291175..5952810 100644 --- a/spring-boot-app-example/src/main/java/io/github/mfvanek/pg/cluster/dtos/EmployeeCreationRequest.java +++ b/spring-boot-app-example/src/main/java/io/github/mfvanek/pg/cluster/dtos/EmployeeCreationRequest.java @@ -1,5 +1,6 @@ package io.github.mfvanek.pg.cluster.dtos; +import com.fasterxml.jackson.annotation.JsonCreator; import jakarta.validation.constraints.DecimalMax; import jakarta.validation.constraints.DecimalMin; import jakarta.validation.constraints.Max; @@ -7,7 +8,6 @@ import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import lombok.Getter; -import lombok.RequiredArgsConstructor; import lombok.ToString; import lombok.experimental.SuperBuilder; @@ -16,7 +16,6 @@ @Getter @ToString @SuperBuilder -@RequiredArgsConstructor public final class EmployeeCreationRequest { @NotNull @@ -35,4 +34,15 @@ public final class EmployeeCreationRequest { @DecimalMax("5000.00") @DecimalMin("100.00") private final BigDecimal salaryPerHour; + + @JsonCreator + public EmployeeCreationRequest(String firstName, + String lastName, + int standardHoursPerDay, + BigDecimal salaryPerHour) { + this.firstName = firstName; + this.lastName = lastName; + this.standardHoursPerDay = standardHoursPerDay; + this.salaryPerHour = salaryPerHour; + } } diff --git a/spring-boot-app-example/src/main/java/io/github/mfvanek/pg/cluster/dtos/EmployeeDto.java b/spring-boot-app-example/src/main/java/io/github/mfvanek/pg/cluster/dtos/EmployeeDto.java index 54fa5f9..e0b22c9 100644 --- a/spring-boot-app-example/src/main/java/io/github/mfvanek/pg/cluster/dtos/EmployeeDto.java +++ b/spring-boot-app-example/src/main/java/io/github/mfvanek/pg/cluster/dtos/EmployeeDto.java @@ -1,7 +1,7 @@ package io.github.mfvanek.pg.cluster.dtos; +import com.fasterxml.jackson.annotation.JsonCreator; import lombok.Getter; -import lombok.RequiredArgsConstructor; import lombok.ToString; import lombok.experimental.SuperBuilder; @@ -10,7 +10,6 @@ import java.util.Objects; import java.util.UUID; -@RequiredArgsConstructor @SuperBuilder @Getter @ToString @@ -24,6 +23,23 @@ public final class EmployeeDto { private final int standardHoursPerDay; private final BigDecimal salaryPerHour; + @JsonCreator + public EmployeeDto(UUID id, + LocalDateTime createdAt, + LocalDateTime updatedAt, + String firstName, + String lastName, + int standardHoursPerDay, + BigDecimal salaryPerHour) { + this.id = id; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.firstName = firstName; + this.lastName = lastName; + this.standardHoursPerDay = standardHoursPerDay; + this.salaryPerHour = salaryPerHour; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/spring-only-app-example/build.gradle.kts b/spring-only-app-example/build.gradle.kts index 4640881..167d16d 100644 --- a/spring-only-app-example/build.gradle.kts +++ b/spring-only-app-example/build.gradle.kts @@ -6,7 +6,7 @@ description = "Spring only application with embedded database" dependencies { implementation(platform(project(":internal-bom"))) - implementation(platform("org.springframework:spring-framework-bom:6.2.6")) + implementation(platform("org.springframework:spring-framework-bom:6.2.7")) implementation("org.springframework:spring-context") implementation("org.springframework:spring-jdbc")