diff --git a/build.gradle b/build.gradle index a5175dfb3ee..17c3763e28a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ plugins { id 'java' - id 'org.springframework.boot' version '3.3.5' + id 'org.springframework.boot' version '3.4.0' id 'io.spring.dependency-management' version '1.1.6' id 'org.graalvm.buildtools.native' version '0.10.3' id 'org.cyclonedx.bom' version '1.10.0' @@ -15,7 +15,7 @@ apply plugin: 'io.spring.javaformat' gradle.startParameter.excludedTaskNames += [ "checkFormatAot", "checkFormatAotTest" ] group = 'org.springframework.samples' -version = '3.3.0' +version = '3.4.0' java { sourceCompatibility = JavaVersion.VERSION_17 @@ -25,12 +25,16 @@ repositories { mavenCentral() } -ext.checkstyleVersion = "10.20.0" +ext.checkstyleVersion = "10.20.1" ext.springJavaformatCheckstyleVersion = "0.0.43" +ext.webjarsLocatorLiteVersion = "1.0.1" ext.webjarsFontawesomeVersion = "4.7.0" ext.webjarsBootstrapVersion = "5.3.3" dependencies { + // Workaround for AOT issue (https://github.com/spring-projects/spring-framework/pull/33949) --> + implementation 'io.projectreactor:reactor-core' + implementation 'org.springframework.boot:spring-boot-starter-cache' implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' @@ -39,6 +43,7 @@ dependencies { implementation 'javax.cache:cache-api' implementation 'jakarta.xml.bind:jakarta.xml.bind-api' runtimeOnly 'org.springframework.boot:spring-boot-starter-actuator' + runtimeOnly "org.webjars:webjars-locator-lite:${webjarsLocatorLiteVersion}" runtimeOnly "org.webjars.npm:bootstrap:${webjarsBootstrapVersion}" runtimeOnly "org.webjars.npm:font-awesome:${webjarsFontawesomeVersion}" runtimeOnly 'com.github.ben-manes.caffeine:caffeine' diff --git a/pom.xml b/pom.xml index bd7f22bc8b4..8cd1b7d8c35 100644 --- a/pom.xml +++ b/pom.xml @@ -1,459 +1,455 @@ - - 4.0.0 + + 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 3.4.0 - - + + org.springframework.boot + spring-boot-starter-parent + 3.4.0 + + - org.springframework.samples - spring-petclinic - 3.4.0-SNAPSHOT + org.springframework.samples + spring-petclinic + 3.4.0-SNAPSHOT - petclinic + petclinic - + - - 17 - UTF-8 - UTF-8 - + 17 + UTF-8 + UTF-8 + - 2023-05-10T07:42:50Z + 2023-05-10T07:42:50Z - - 1.0.1 - 5.3.3 - 4.7.0 + + 1.0.1 + 5.3.3 + 4.7.0 - 10.20.0 - 0.8.12 - 0.2.29 - 1.0.0 - 3.6.0 - 0.0.11 - 0.0.43 + 10.20.1 + 0.8.12 + 0.2.29 + 1.0.0 + 3.6.0 + 0.0.11 + 0.0.43 - + - - - - org.springframework.boot - spring-boot-starter-actuator - - - org.springframework.boot - spring-boot-starter-cache - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-validation - - - org.springframework.boot - spring-boot-starter-thymeleaf - - - org.springframework.boot - spring-boot-starter-test - test - - - - io.projectreactor - reactor-core - + + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-cache + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-validation + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-test + test + + + + io.projectreactor + reactor-core + - - - com.h2database - h2 - runtime - - - com.mysql - mysql-connector-j - runtime - - - org.postgresql - postgresql - runtime - + + + com.h2database + h2 + runtime + + + com.mysql + mysql-connector-j + runtime + + + org.postgresql + postgresql + runtime + - - - javax.cache - cache-api - - - com.github.ben-manes.caffeine - caffeine - + + + javax.cache + cache-api + + + com.github.ben-manes.caffeine + caffeine + - - - org.webjars - webjars-locator-lite - ${webjars-locator.version} - - - org.webjars.npm - bootstrap - ${webjars-bootstrap.version} - - - org.webjars.npm - font-awesome - ${webjars-font-awesome.version} - + + + org.webjars + webjars-locator-lite + ${webjars-locator.version} + + + org.webjars.npm + bootstrap + ${webjars-bootstrap.version} + + + org.webjars.npm + font-awesome + ${webjars-font-awesome.version} + - - org.springframework.boot - spring-boot-devtools - test - - - org.springframework.boot - spring-boot-testcontainers - test - - - org.springframework.boot - spring-boot-docker-compose - test - - - org.testcontainers - junit-jupiter - test - - - org.testcontainers - mysql - test - + + org.springframework.boot + spring-boot-devtools + test + + + org.springframework.boot + spring-boot-testcontainers + test + + + org.springframework.boot + spring-boot-docker-compose + test + + + org.testcontainers + junit-jupiter + test + + + org.testcontainers + mysql + test + - - jakarta.xml.bind - jakarta.xml.bind-api - + + jakarta.xml.bind + jakarta.xml.bind-api + - + - - - - org.apache.maven.plugins - maven-enforcer-plugin - - - enforce-java - - enforce - - - - - This build requires at least Java ${java.version}, + + + + org.apache.maven.plugins + maven-enforcer-plugin + + + enforce-java + + enforce + + + + + This build requires at least Java ${java.version}, update your JVM, and run the build again - ${java.version} - - - - - - - - io.spring.javaformat - spring-javaformat-maven-plugin - ${spring-format.version} - - - - validate - - validate - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - ${maven-checkstyle.version} - - - com.puppycrawl.tools - checkstyle - ${checkstyle.version} - - - io.spring.nohttp - nohttp-checkstyle - ${nohttp-checkstyle.version} - - - - - nohttp-checkstyle-validation - - check - - validate - - src/checkstyle/nohttp-checkstyle.xml - ${basedir} - **/* - - **/.git/**/*,**/.idea/**/*,**/target/**/,**/.flattened-pom.xml,**/*.class - config_loc=${basedir}/src/checkstyle/ - - - - - - org.graalvm.buildtools - native-maven-plugin - - - org.springframework.boot - spring-boot-maven-plugin - - - - - build-info - - - - ${project.build.sourceEncoding} - ${project.reporting.outputEncoding} - ${java.version} - ${java.version} - - - - - - - org.jacoco - jacoco-maven-plugin - ${jacoco.version} - - - - prepare-agent - - - - report - - report - - prepare-package - - - + + build-info + + + + ${project.build.sourceEncoding} + ${project.reporting.outputEncoding} + ${java.version} + ${java.version} + + + + + + + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + + prepare-agent + + + + report + + report + + prepare-package + + + - - - io.github.git-commit-id - git-commit-id-maven-plugin - - false - false - - - - - - org.cyclonedx - cyclonedx-maven-plugin - + + + org.cyclonedx + cyclonedx-maven-plugin + - - - - - Apache License, Version 2.0 - https://www.apache.org/licenses/LICENSE-2.0 - - + + + + + Apache License, Version 2.0 + https://www.apache.org/licenses/LICENSE-2.0 + + - - - - true - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - - - false - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - - - - - true - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - - - false - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - + + + + true + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + + + false + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + + + true + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + + + false + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + - - - css - - - - org.apache.maven.plugins - maven-dependency-plugin - - - unpack - - unpack - - - generate-resources - - - - org.webjars.npm - bootstrap - ${webjars-bootstrap.version} - - - ${project.build.directory}/webjars - - - - + + + css + + + + org.apache.maven.plugins + maven-dependency-plugin + + + unpack + + unpack + + + generate-resources + + + + org.webjars.npm + bootstrap + ${webjars-bootstrap.version} + + + ${project.build.directory}/webjars + + + + - - com.gitlab.haynes - libsass-maven-plugin - ${libsass.version} - - ${basedir}/src/main/scss/ - ${basedir}/src/main/resources/static/resources/css/ - - ${project.build.directory}/webjars/META-INF/resources/webjars/bootstrap/${webjars-bootstrap.version}/scss/ - - - - - - compile - - generate-resources - - - - - - - - m2e - - - m2e.version - - - - - - - - org.eclipse.m2e - lifecycle-mapping - ${lifecycle-mapping} - - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - [1,) - - check - - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - [1,) - - build-info - - - - - - - - - io.spring.javaformat - spring-javaformat-maven-plugin - [0,) - - validate - - - - - - - - - - - - - - - - \ No newline at end of file + + org.eclipse.m2e + lifecycle-mapping + ${lifecycle-mapping} + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + [1,) + + check + + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + [1,) + + build-info + + + + + + + + + io.spring.javaformat + spring-javaformat-maven-plugin + [0,) + + validate + + + + + + + + + + + + + + + + diff --git a/src/main/java/org/springframework/samples/petclinic/owner/OwnerRepository.java b/src/main/java/org/springframework/samples/petclinic/owner/OwnerRepository.java index 63fae196f53..b91d80d8b49 100644 --- a/src/main/java/org/springframework/samples/petclinic/owner/OwnerRepository.java +++ b/src/main/java/org/springframework/samples/petclinic/owner/OwnerRepository.java @@ -23,7 +23,6 @@ import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.query.Param; import org.springframework.transaction.annotation.Transactional; /** diff --git a/src/main/java/org/springframework/samples/petclinic/owner/VisitController.java b/src/main/java/org/springframework/samples/petclinic/owner/VisitController.java index 542d4718415..b546f609a34 100644 --- a/src/main/java/org/springframework/samples/petclinic/owner/VisitController.java +++ b/src/main/java/org/springframework/samples/petclinic/owner/VisitController.java @@ -17,7 +17,6 @@ import java.util.Map; import java.util.Optional; -import java.util.OptionalInt; import org.springframework.stereotype.Controller; import org.springframework.validation.BindingResult; diff --git a/src/test/java/org/springframework/samples/petclinic/owner/OwnerControllerTests.java b/src/test/java/org/springframework/samples/petclinic/owner/OwnerControllerTests.java index c285f39f5b5..426ca5c24e4 100644 --- a/src/test/java/org/springframework/samples/petclinic/owner/OwnerControllerTests.java +++ b/src/test/java/org/springframework/samples/petclinic/owner/OwnerControllerTests.java @@ -22,11 +22,11 @@ import org.junit.jupiter.api.condition.DisabledInNativeImage; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.Pageable; import org.springframework.test.context.aot.DisabledInAotMode; +import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; @@ -65,7 +65,7 @@ class OwnerControllerTests { @Autowired private MockMvc mockMvc; - @MockBean + @MockitoBean private OwnerRepository owners; private Owner george() { diff --git a/src/test/java/org/springframework/samples/petclinic/owner/PetControllerTests.java b/src/test/java/org/springframework/samples/petclinic/owner/PetControllerTests.java index 14ae32576b7..9a6134cbb7f 100644 --- a/src/test/java/org/springframework/samples/petclinic/owner/PetControllerTests.java +++ b/src/test/java/org/springframework/samples/petclinic/owner/PetControllerTests.java @@ -17,24 +17,21 @@ package org.springframework.samples.petclinic.owner; import org.assertj.core.util.Lists; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.DisabledInNativeImage; -import org.mockito.Mockito; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.FilterType; import org.springframework.test.context.aot.DisabledInAotMode; +import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.test.web.servlet.MockMvc; import java.time.LocalDate; import java.util.Optional; -import static org.junit.Assert.assertNotNull; import static org.mockito.BDDMockito.given; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; @@ -61,7 +58,7 @@ class PetControllerTests { @Autowired private MockMvc mockMvc; - @MockBean + @MockitoBean private OwnerRepository owners; @BeforeEach diff --git a/src/test/java/org/springframework/samples/petclinic/owner/VisitControllerTests.java b/src/test/java/org/springframework/samples/petclinic/owner/VisitControllerTests.java index 8f44aace96a..e42e75034ab 100644 --- a/src/test/java/org/springframework/samples/petclinic/owner/VisitControllerTests.java +++ b/src/test/java/org/springframework/samples/petclinic/owner/VisitControllerTests.java @@ -28,8 +28,8 @@ import org.junit.jupiter.api.condition.DisabledInNativeImage; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.test.context.aot.DisabledInAotMode; +import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.test.web.servlet.MockMvc; import java.util.Optional; @@ -52,7 +52,7 @@ class VisitControllerTests { @Autowired private MockMvc mockMvc; - @MockBean + @MockitoBean private OwnerRepository owners; @BeforeEach diff --git a/src/test/java/org/springframework/samples/petclinic/vet/VetControllerTests.java b/src/test/java/org/springframework/samples/petclinic/vet/VetControllerTests.java index 20c3f46ce33..5fffeea477e 100644 --- a/src/test/java/org/springframework/samples/petclinic/vet/VetControllerTests.java +++ b/src/test/java/org/springframework/samples/petclinic/vet/VetControllerTests.java @@ -22,11 +22,11 @@ import org.junit.jupiter.api.condition.DisabledInNativeImage; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.Pageable; import org.springframework.http.MediaType; import org.springframework.test.context.aot.DisabledInAotMode; +import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.ResultActions; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; @@ -48,7 +48,7 @@ class VetControllerTests { @Autowired private MockMvc mockMvc; - @MockBean + @MockitoBean private VetRepository vets; private Vet james() {