From 780502e42b52455d39373e7e10bbd8068bfe0c07 Mon Sep 17 00:00:00 2001 From: Sergio del Amo Date: Mon, 12 Feb 2024 11:34:09 +0100 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20don=E2=80=99t=20leakage=20Micronaut?= =?UTF-8?q?=20Validation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hibernate-jpa/build.gradle | 4 +++- hibernate-reactive/build.gradle | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/hibernate-jpa/build.gradle b/hibernate-jpa/build.gradle index 4fc1f31fd..a3ab7f066 100644 --- a/hibernate-jpa/build.gradle +++ b/hibernate-jpa/build.gradle @@ -7,7 +7,7 @@ dependencies { api(libs.managed.hibernate.core) api(libs.managed.jakarta.transaction.api) - api(mnValidation.micronaut.validation) + implementation(mnValidation.validation) // jakarta.validation:jakarta.validation-api compileOnly(mnData.micronaut.data.tx.hibernate) testImplementation(mnData.micronaut.data.tx.hibernate) api(mn.micronaut.aop) @@ -28,6 +28,8 @@ dependencies { testImplementation(mnMicrometer.micronaut.micrometer.core) testImplementation(libs.managed.hibernate.micrometer) + testImplementation(mnValidation.micronaut.validation) + testRuntimeOnly projects.micronautJdbcTomcat testRuntimeOnly(libs.managed.h2) diff --git a/hibernate-reactive/build.gradle b/hibernate-reactive/build.gradle index 1f79ab570..0ea711fa4 100644 --- a/hibernate-reactive/build.gradle +++ b/hibernate-reactive/build.gradle @@ -26,4 +26,5 @@ dependencies { testImplementation(mnTestResources.testcontainers.postgres) testImplementation libs.managed.vertx.pg.client testImplementation(mnData.micronaut.data.tx.hibernate) + testImplementation(mnValidation.micronaut.validation) } From d0f84c7062992a6deffe695205b1c39502fc79d1 Mon Sep 17 00:00:00 2001 From: Sergio del Amo Date: Mon, 12 Feb 2024 11:42:24 +0100 Subject: [PATCH 2/3] test with hibernate validator --- gradle/libs.versions.toml | 5 +---- hibernate-jpa/build.gradle | 2 +- settings.gradle | 1 + 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7be3fb289..91d455a18 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -68,7 +68,7 @@ sonar-gradle-plugin = "4.4.1.3373" micronaut-core = { module = 'io.micronaut:micronaut-core-bom', version.ref = 'micronaut' } # Platform catalogs - +micronaut-hibernate-validator = { module = "io.micronaut.beanvalidation:micronaut-hibernate-validator-bom", version.ref = "micronaut-hibernate-validator" } micronaut-cache = { module = "io.micronaut.cache:micronaut-cache-bom", version.ref = "micronaut-cache" } micronaut-data = { module = "io.micronaut.data:micronaut-data-bom", version.ref = "micronaut-data" } micronaut-micrometer = { module = "io.micronaut.micrometer:micronaut-micrometer-bom", version.ref = "micronaut-micrometer" } @@ -80,9 +80,6 @@ micronaut-test = { module = "io.micronaut.test:micronaut-test-bom", version.ref micronaut-test-resources = { module = "io.micronaut.testresources:micronaut-test-resources-bom", version.ref = "micronaut-test-resources" } micronaut-validation = { module = "io.micronaut.validation:micronaut-validation-bom", version.ref = "micronaut-validation" } -# Switch to BOM and catalog import when there's a bom -micronaut-hibernate-validator = { module = "io.micronaut.beanvalidation:micronaut-hibernate-validator", version.ref = "micronaut-hibernate-validator" } - # Vertx managed-vertx-sql-client = { module = "io.vertx:vertx-sql-client", version.ref = "managed-vertx" } diff --git a/hibernate-jpa/build.gradle b/hibernate-jpa/build.gradle index a3ab7f066..ce24e4203 100644 --- a/hibernate-jpa/build.gradle +++ b/hibernate-jpa/build.gradle @@ -28,7 +28,7 @@ dependencies { testImplementation(mnMicrometer.micronaut.micrometer.core) testImplementation(libs.managed.hibernate.micrometer) - testImplementation(mnValidation.micronaut.validation) + testImplementation(mnHibernateValidator.micronaut.hibernate.validator) testRuntimeOnly projects.micronautJdbcTomcat testRuntimeOnly(libs.managed.h2) diff --git a/settings.gradle b/settings.gradle index f37f7ffb3..60bc02b1a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -23,6 +23,7 @@ micronautBuild { importMicronautCatalog("micronaut-spring") importMicronautCatalog("micronaut-test-resources") importMicronautCatalog("micronaut-validation") + importMicronautCatalog("micronaut-hibernate-validator") } rootProject.name = 'sql-parent' From 09609a2793f82bf6ea335a4d4e29ab72765c7df9 Mon Sep 17 00:00:00 2001 From: Sergio del Amo Date: Mon, 12 Feb 2024 13:07:29 +0100 Subject: [PATCH 3/3] jakarta-valdiation-api as compileOnly --- hibernate-jpa/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hibernate-jpa/build.gradle b/hibernate-jpa/build.gradle index ce24e4203..92217667c 100644 --- a/hibernate-jpa/build.gradle +++ b/hibernate-jpa/build.gradle @@ -7,7 +7,7 @@ dependencies { api(libs.managed.hibernate.core) api(libs.managed.jakarta.transaction.api) - implementation(mnValidation.validation) // jakarta.validation:jakarta.validation-api + compileOnly(mnValidation.validation) // jakarta.validation:jakarta.validation-api compileOnly(mnData.micronaut.data.tx.hibernate) testImplementation(mnData.micronaut.data.tx.hibernate) api(mn.micronaut.aop)