From 91f55a4f7134409a832435de2c6df231102d5898 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Wed, 27 Nov 2024 08:32:30 +0000 Subject: [PATCH] Versionless webjars (again) Spring Boot 3.4 supports the webjars-locator-lite which in turn supports native images, so we are back to versionless URLs for webjars assets in templates. --- pom.xml | 877 +++++++++--------- .../petclinic/PetClinicRuntimeHints.java | 1 - .../resources/templates/fragments/layout.html | 4 +- src/test/jmeter/petclinic_test_plan.jmx | 2 +- 4 files changed, 450 insertions(+), 434 deletions(-) diff --git a/pom.xml b/pom.xml index a50e40647..bd7f22bc8 100644 --- a/pom.xml +++ b/pom.xml @@ -1,442 +1,459 @@ - - 4.0.0 + + 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 3.4.0 - - - - org.springframework.samples - spring-petclinic - 3.4.0-SNAPSHOT - - petclinic - - - - - 17 - UTF-8 - UTF-8 - - 2023-05-10T07:42:50Z - - - 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 - - - - - - - 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 - - - - - com.h2database - h2 - runtime - - - com.mysql - mysql-connector-j - runtime - - - org.postgresql - postgresql - runtime - - - - - javax.cache - cache-api - - - com.github.ben-manes.caffeine - caffeine - - - - - 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 - - - - 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}, 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 - - - + spring-boot-starter-parent + 3.4.0 + + - - - io.github.git-commit-id - git-commit-id-maven-plugin - - false - false - - - - - - org.cyclonedx - cyclonedx-maven-plugin - + org.springframework.samples + spring-petclinic + 3.4.0-SNAPSHOT - - - - - Apache License, Version 2.0 - https://www.apache.org/licenses/LICENSE-2.0 - - + petclinic - - - - 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 - + + 17 + UTF-8 + UTF-8 + + 2023-05-10T07:42:50Z + + + 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 + + + + + + + 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 + + + + + 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.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 + + + + + - - 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,) + org.apache.maven.plugins + maven-enforcer-plugin + + + enforce-java - check + enforce - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - [1,) - - build-info - - - - - - - - - io.spring.javaformat - spring-javaformat-maven-plugin - [0,) - - validate - - - - - - - - - + + + + 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 + + + + + + + io.github.git-commit-id + git-commit-id-maven-plugin + + false + false + + + + + + org.cyclonedx + cyclonedx-maven-plugin + + + + + + + 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 + + + + + + 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 diff --git a/src/main/java/org/springframework/samples/petclinic/PetClinicRuntimeHints.java b/src/main/java/org/springframework/samples/petclinic/PetClinicRuntimeHints.java index 7acecf469..2975923d7 100644 --- a/src/main/java/org/springframework/samples/petclinic/PetClinicRuntimeHints.java +++ b/src/main/java/org/springframework/samples/petclinic/PetClinicRuntimeHints.java @@ -28,7 +28,6 @@ public class PetClinicRuntimeHints implements RuntimeHintsRegistrar { public void registerHints(RuntimeHints hints, ClassLoader classLoader) { hints.resources().registerPattern("db/*"); // https://github.com/spring-projects/spring-boot/issues/32654 hints.resources().registerPattern("messages/*"); - hints.resources().registerPattern("META-INF/resources/webjars/*"); hints.resources().registerPattern("mysql-default-conf"); hints.serialization().registerType(BaseEntity.class); hints.serialization().registerType(Person.class); diff --git a/src/main/resources/templates/fragments/layout.html b/src/main/resources/templates/fragments/layout.html index 3e9bc398b..eb54d28ae 100644 --- a/src/main/resources/templates/fragments/layout.html +++ b/src/main/resources/templates/fragments/layout.html @@ -17,7 +17,7 @@ - + @@ -87,7 +87,7 @@ - + diff --git a/src/test/jmeter/petclinic_test_plan.jmx b/src/test/jmeter/petclinic_test_plan.jmx index aeb3bd2eb..89c7bf210 100644 --- a/src/test/jmeter/petclinic_test_plan.jmx +++ b/src/test/jmeter/petclinic_test_plan.jmx @@ -156,7 +156,7 @@ - ${CONTEXT_WEB}/webjars/bootstrap/5.3.3/dist/js/bootstrap.bundle.min.js + ${CONTEXT_WEB}/webjars/bootstrap/dist/js/bootstrap.bundle.min.js GET true false