From 4367b5fa3678b295e77a0ca741961af73caab466 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Mon, 25 Nov 2024 16:29:50 +0100 Subject: [PATCH 1/6] Avoid reifing Agroal configuration too early In OracleAgroalConnectionConfigurer, we are reifing the Agroal config and we shouldn't do it at this stage. We need to check the properties directly and thus we add them to AgroalConnectionConfigurer. I kept the old method for now but it will be removed at some point in the future. Fixes #44687 --- .../agroal/runtime/AgroalConnectionConfigurer.java | 11 +++++++++++ .../java/io/quarkus/agroal/runtime/DataSources.java | 3 ++- .../h2/runtime/H2AgroalConnectionConfigurer.java | 5 ++++- .../runtime/MariaDBAgroalConnectionConfigurer.java | 5 ++++- .../runtime/MsSQLAgroalConnectionConfigurer.java | 5 ++++- .../runtime/MySQLAgroalConnectionConfigurer.java | 5 ++++- .../runtime/OracleAgroalConnectionConfigurer.java | 13 +++++-------- .../PostgreSQLAgroalConnectionConfigurer.java | 5 ++++- 8 files changed, 38 insertions(+), 14 deletions(-) diff --git a/extensions/agroal/runtime/src/main/java/io/quarkus/agroal/runtime/AgroalConnectionConfigurer.java b/extensions/agroal/runtime/src/main/java/io/quarkus/agroal/runtime/AgroalConnectionConfigurer.java index d052e08ec0412..16ea62912403a 100644 --- a/extensions/agroal/runtime/src/main/java/io/quarkus/agroal/runtime/AgroalConnectionConfigurer.java +++ b/extensions/agroal/runtime/src/main/java/io/quarkus/agroal/runtime/AgroalConnectionConfigurer.java @@ -1,5 +1,7 @@ package io.quarkus.agroal.runtime; +import java.util.Map; + import org.jboss.logging.Logger; import io.agroal.api.configuration.supplier.AgroalDataSourceConfigurationSupplier; @@ -8,10 +10,19 @@ public interface AgroalConnectionConfigurer { Logger log = Logger.getLogger(AgroalConnectionConfigurer.class.getName()); + /** + * @deprecated use {@link #disableSslSupport(String, AgroalDataSourceConfigurationSupplier, Map)} instead + */ + @Deprecated(since = "3.18", forRemoval = true) default void disableSslSupport(String databaseKind, AgroalDataSourceConfigurationSupplier dataSourceConfiguration) { log.warnv("Agroal does not support disabling SSL for database kind: {0}", databaseKind); } + default void disableSslSupport(String databaseKind, AgroalDataSourceConfigurationSupplier dataSourceConfiguration, + Map additionalJdbcProperties) { + disableSslSupport(databaseKind, dataSourceConfiguration); + } + default void setExceptionSorter(String databaseKind, AgroalDataSourceConfigurationSupplier dataSourceConfiguration) { log.warnv("Agroal does not support detecting if a connection is still usable after an exception for database kind: {0}", databaseKind); diff --git a/extensions/agroal/runtime/src/main/java/io/quarkus/agroal/runtime/DataSources.java b/extensions/agroal/runtime/src/main/java/io/quarkus/agroal/runtime/DataSources.java index 4e08c4440c1cb..eb719e72ac136 100644 --- a/extensions/agroal/runtime/src/main/java/io/quarkus/agroal/runtime/DataSources.java +++ b/extensions/agroal/runtime/src/main/java/io/quarkus/agroal/runtime/DataSources.java @@ -195,7 +195,8 @@ public AgroalDataSource createDataSource(String dataSourceName) { mpMetricsPresent); if (agroalDataSourceSupport.disableSslSupport) { - agroalConnectionConfigurer.disableSslSupport(resolvedDbKind, dataSourceConfiguration); + agroalConnectionConfigurer.disableSslSupport(resolvedDbKind, dataSourceConfiguration, + dataSourceJdbcRuntimeConfig.additionalJdbcProperties()); } //we use a custom cache for two reasons: //fast thread local cache should be faster diff --git a/extensions/jdbc/jdbc-h2/runtime/src/main/java/io/quarkus/jdbc/h2/runtime/H2AgroalConnectionConfigurer.java b/extensions/jdbc/jdbc-h2/runtime/src/main/java/io/quarkus/jdbc/h2/runtime/H2AgroalConnectionConfigurer.java index b328ba6eec529..e657afd7740e9 100644 --- a/extensions/jdbc/jdbc-h2/runtime/src/main/java/io/quarkus/jdbc/h2/runtime/H2AgroalConnectionConfigurer.java +++ b/extensions/jdbc/jdbc-h2/runtime/src/main/java/io/quarkus/jdbc/h2/runtime/H2AgroalConnectionConfigurer.java @@ -1,5 +1,7 @@ package io.quarkus.jdbc.h2.runtime; +import java.util.Map; + import io.agroal.api.configuration.supplier.AgroalDataSourceConfigurationSupplier; import io.quarkus.agroal.runtime.AgroalConnectionConfigurer; import io.quarkus.agroal.runtime.JdbcDriver; @@ -9,7 +11,8 @@ public class H2AgroalConnectionConfigurer implements AgroalConnectionConfigurer { @Override - public void disableSslSupport(String databaseKind, AgroalDataSourceConfigurationSupplier dataSourceConfiguration) { + public void disableSslSupport(String databaseKind, AgroalDataSourceConfigurationSupplier dataSourceConfiguration, + Map additionalProperties) { // do not log anything for H2 } diff --git a/extensions/jdbc/jdbc-mariadb/runtime/src/main/java/io/quarkus/jdbc/mariadb/runtime/MariaDBAgroalConnectionConfigurer.java b/extensions/jdbc/jdbc-mariadb/runtime/src/main/java/io/quarkus/jdbc/mariadb/runtime/MariaDBAgroalConnectionConfigurer.java index 1c3e7cfdb498b..e881fa66be567 100644 --- a/extensions/jdbc/jdbc-mariadb/runtime/src/main/java/io/quarkus/jdbc/mariadb/runtime/MariaDBAgroalConnectionConfigurer.java +++ b/extensions/jdbc/jdbc-mariadb/runtime/src/main/java/io/quarkus/jdbc/mariadb/runtime/MariaDBAgroalConnectionConfigurer.java @@ -1,5 +1,7 @@ package io.quarkus.jdbc.mariadb.runtime; +import java.util.Map; + import io.agroal.api.configuration.supplier.AgroalDataSourceConfigurationSupplier; import io.agroal.api.exceptionsorter.MySQLExceptionSorter; import io.quarkus.agroal.runtime.AgroalConnectionConfigurer; @@ -10,7 +12,8 @@ public class MariaDBAgroalConnectionConfigurer implements AgroalConnectionConfigurer { @Override - public void disableSslSupport(String databaseKind, AgroalDataSourceConfigurationSupplier dataSourceConfiguration) { + public void disableSslSupport(String databaseKind, AgroalDataSourceConfigurationSupplier dataSourceConfiguration, + Map additionalProperties) { dataSourceConfiguration.connectionPoolConfiguration().connectionFactoryConfiguration().jdbcProperty("useSSL", "false"); } diff --git a/extensions/jdbc/jdbc-mssql/runtime/src/main/java/io/quarkus/jdbc/mssql/runtime/MsSQLAgroalConnectionConfigurer.java b/extensions/jdbc/jdbc-mssql/runtime/src/main/java/io/quarkus/jdbc/mssql/runtime/MsSQLAgroalConnectionConfigurer.java index 63656467decd0..40825458fcfee 100644 --- a/extensions/jdbc/jdbc-mssql/runtime/src/main/java/io/quarkus/jdbc/mssql/runtime/MsSQLAgroalConnectionConfigurer.java +++ b/extensions/jdbc/jdbc-mssql/runtime/src/main/java/io/quarkus/jdbc/mssql/runtime/MsSQLAgroalConnectionConfigurer.java @@ -1,5 +1,7 @@ package io.quarkus.jdbc.mssql.runtime; +import java.util.Map; + import io.agroal.api.configuration.supplier.AgroalDataSourceConfigurationSupplier; import io.agroal.api.exceptionsorter.MSSQLExceptionSorter; import io.quarkus.agroal.runtime.AgroalConnectionConfigurer; @@ -10,7 +12,8 @@ public class MsSQLAgroalConnectionConfigurer implements AgroalConnectionConfigurer { @Override - public void disableSslSupport(String databaseKind, AgroalDataSourceConfigurationSupplier dataSourceConfiguration) { + public void disableSslSupport(String databaseKind, AgroalDataSourceConfigurationSupplier dataSourceConfiguration, + Map additionalProperties) { dataSourceConfiguration.connectionPoolConfiguration().connectionFactoryConfiguration().jdbcProperty("encrypt", "false"); } diff --git a/extensions/jdbc/jdbc-mysql/runtime/src/main/java/io/quarkus/jdbc/mysql/runtime/MySQLAgroalConnectionConfigurer.java b/extensions/jdbc/jdbc-mysql/runtime/src/main/java/io/quarkus/jdbc/mysql/runtime/MySQLAgroalConnectionConfigurer.java index 6c9b5131f2f49..faf10a713e3b2 100644 --- a/extensions/jdbc/jdbc-mysql/runtime/src/main/java/io/quarkus/jdbc/mysql/runtime/MySQLAgroalConnectionConfigurer.java +++ b/extensions/jdbc/jdbc-mysql/runtime/src/main/java/io/quarkus/jdbc/mysql/runtime/MySQLAgroalConnectionConfigurer.java @@ -1,5 +1,7 @@ package io.quarkus.jdbc.mysql.runtime; +import java.util.Map; + import io.agroal.api.configuration.supplier.AgroalDataSourceConfigurationSupplier; import io.agroal.api.exceptionsorter.MySQLExceptionSorter; import io.quarkus.agroal.runtime.AgroalConnectionConfigurer; @@ -10,7 +12,8 @@ public class MySQLAgroalConnectionConfigurer implements AgroalConnectionConfigurer { @Override - public void disableSslSupport(String databaseKind, AgroalDataSourceConfigurationSupplier dataSourceConfiguration) { + public void disableSslSupport(String databaseKind, AgroalDataSourceConfigurationSupplier dataSourceConfiguration, + Map additionalProperties) { dataSourceConfiguration.connectionPoolConfiguration().connectionFactoryConfiguration().jdbcProperty("useSSL", "false"); } diff --git a/extensions/jdbc/jdbc-oracle/runtime/src/main/java/io/quarkus/jdbc/oracle/runtime/OracleAgroalConnectionConfigurer.java b/extensions/jdbc/jdbc-oracle/runtime/src/main/java/io/quarkus/jdbc/oracle/runtime/OracleAgroalConnectionConfigurer.java index b2de7d8e2f373..7f73446972475 100644 --- a/extensions/jdbc/jdbc-oracle/runtime/src/main/java/io/quarkus/jdbc/oracle/runtime/OracleAgroalConnectionConfigurer.java +++ b/extensions/jdbc/jdbc-oracle/runtime/src/main/java/io/quarkus/jdbc/oracle/runtime/OracleAgroalConnectionConfigurer.java @@ -1,6 +1,6 @@ package io.quarkus.jdbc.oracle.runtime; -import java.util.Properties; +import java.util.Map; import io.agroal.api.configuration.supplier.AgroalDataSourceConfigurationSupplier; import io.agroal.api.exceptionsorter.OracleExceptionSorter; @@ -19,13 +19,10 @@ public class OracleAgroalConnectionConfigurer implements AgroalConnectionConfigu * enable it. */ @Override - public void disableSslSupport(String databaseKind, AgroalDataSourceConfigurationSupplier dataSourceConfiguration) { - final Properties jdbcProperties = dataSourceConfiguration.connectionPoolConfiguration() - .connectionFactoryConfiguration() - .get() - .jdbcProperties(); - final Object setting = jdbcProperties.get("oracle.net.authentication_services"); - if (setting != null && "SSL".equalsIgnoreCase(setting.toString())) { + public void disableSslSupport(String databaseKind, AgroalDataSourceConfigurationSupplier dataSourceConfiguration, + Map additionalProperties) { + final String property = additionalProperties.get("oracle.net.authentication_services"); + if (property != null && "SSL".equalsIgnoreCase(property)) { log.warnv( "SSL support has been disabled, but one of the Oracle JDBC connections has been configured to use SSL. This will likely fail"); } diff --git a/extensions/jdbc/jdbc-postgresql/runtime/src/main/java/io/quarkus/jdbc/postgresql/runtime/PostgreSQLAgroalConnectionConfigurer.java b/extensions/jdbc/jdbc-postgresql/runtime/src/main/java/io/quarkus/jdbc/postgresql/runtime/PostgreSQLAgroalConnectionConfigurer.java index 168adafd8aa65..9c4e3bb61d5a9 100644 --- a/extensions/jdbc/jdbc-postgresql/runtime/src/main/java/io/quarkus/jdbc/postgresql/runtime/PostgreSQLAgroalConnectionConfigurer.java +++ b/extensions/jdbc/jdbc-postgresql/runtime/src/main/java/io/quarkus/jdbc/postgresql/runtime/PostgreSQLAgroalConnectionConfigurer.java @@ -1,5 +1,7 @@ package io.quarkus.jdbc.postgresql.runtime; +import java.util.Map; + import io.agroal.api.configuration.supplier.AgroalDataSourceConfigurationSupplier; import io.agroal.api.exceptionsorter.PostgreSQLExceptionSorter; import io.quarkus.agroal.runtime.AgroalConnectionConfigurer; @@ -10,7 +12,8 @@ public class PostgreSQLAgroalConnectionConfigurer implements AgroalConnectionConfigurer { @Override - public void disableSslSupport(String databaseKind, AgroalDataSourceConfigurationSupplier dataSourceConfiguration) { + public void disableSslSupport(String databaseKind, AgroalDataSourceConfigurationSupplier dataSourceConfiguration, + Map additionalProperties) { dataSourceConfiguration.connectionPoolConfiguration().connectionFactoryConfiguration().jdbcProperty("sslmode", "disable"); } From e74d9c7016778fee636e5442884973faa2a6a941 Mon Sep 17 00:00:00 2001 From: xstefank Date: Thu, 14 Nov 2024 15:13:39 +0100 Subject: [PATCH 2/6] Move narayana-lra extension to the new separated LRA project --- bom/application/pom.xml | 35 +++++++------------------ extensions/narayana-lra/runtime/pom.xml | 12 ++++----- 2 files changed, 15 insertions(+), 32 deletions(-) diff --git a/bom/application/pom.xml b/bom/application/pom.xml index b482be3b39686..b95e3fbc3f68a 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -97,6 +97,7 @@ 7.1.0.Final + 0.0.9.Final 2.5 8.0.0.Final 8.16.1 @@ -4781,14 +4782,10 @@ ${microprofile-lra.version} - org.jboss.narayana.rts + org.jboss.narayana.lra narayana-lra - ${narayana.version} + ${narayana-lra.version} - - org.jboss.narayana.rts - narayana-lra - commons-logging commons-logging @@ -4804,14 +4801,10 @@ - org.jboss.narayana.rts + org.jboss.narayana.lra lra-service-base - ${narayana.version} + ${narayana-lra.version} - - org.jboss.narayana.rts - lra-service-base - commons-logging commons-logging @@ -4824,25 +4817,15 @@ - org.jboss.narayana.rts + org.jboss.narayana.lra lra-proxy-api - ${narayana.version} - - - org.jboss.narayana.rts - lra-proxy-api - - + ${narayana-lra.version} - org.jboss.narayana.rts + org.jboss.narayana.lra lra-client - ${narayana.version} + ${narayana-lra.version} - - org.jboss.narayana.rts - lra-client - jakarta.activation jakarta.activation-api diff --git a/extensions/narayana-lra/runtime/pom.xml b/extensions/narayana-lra/runtime/pom.xml index 5cd719cacd84b..5d0deec48dcd2 100644 --- a/extensions/narayana-lra/runtime/pom.xml +++ b/extensions/narayana-lra/runtime/pom.xml @@ -20,11 +20,11 @@ quarkus-arc - org.jboss.narayana.rts + org.jboss.narayana.lra narayana-lra - org.jboss.narayana.rts + org.jboss.narayana.lra lra-service-base @@ -34,7 +34,7 @@ - org.jboss.narayana.rts + org.jboss.narayana.lra lra-proxy-api @@ -44,7 +44,7 @@ - org.jboss.narayana.rts + org.jboss.narayana.lra lra-client @@ -69,11 +69,11 @@ - org.jboss.narayana.rts:narayana-lra + org.jboss.narayana.lra:narayana-lra META-INF/services/jakarta.ws.rs.client.ClientBuilder - org.jboss.narayana.rts:lra-client + org.jboss.narayana.lra:lra-client META-INF/services/jakarta.ws.rs.client.ClientBuilder From 6662ad3811d6f927f6b14160b32f913c56f97589 Mon Sep 17 00:00:00 2001 From: "David M. Lloyd" Date: Fri, 22 Nov 2024 09:55:26 -0600 Subject: [PATCH 3/6] Improve debugging of `GeneratedClassBuildItem` --- .../builditem/GeneratedClassBuildItem.java | 34 +++++++++++++++++++ .../deployment/DefaultSerdeConfigTest.java | 3 +- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/core/deployment/src/main/java/io/quarkus/deployment/builditem/GeneratedClassBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/builditem/GeneratedClassBuildItem.java index 00fb49e11a23b..cc105fbc498c4 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/builditem/GeneratedClassBuildItem.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/builditem/GeneratedClassBuildItem.java @@ -6,6 +6,8 @@ public final class GeneratedClassBuildItem extends MultiBuildItem { final boolean applicationClass; final String name; + String binaryName; + String internalName; final byte[] classData; final String source; @@ -27,10 +29,39 @@ public boolean isApplicationClass() { return applicationClass; } + /** + * {@return a name for this class} + * + * @deprecated This method may return the binary name, the internal name, or a hybrid thereof and should not be + * used. Use {@link #binaryName()} or {@link #internalName()} instead. + */ + @Deprecated(forRemoval = true) public String getName() { return name; } + /** + * {@return the binary name of the class, which is delimited by . characters} + */ + public String binaryName() { + String binaryName = this.binaryName; + if (binaryName == null) { + binaryName = this.binaryName = name.replace('/', '.'); + } + return binaryName; + } + + /** + * {@return the internal name of the class, which is delimited by / characters} + */ + public String internalName() { + String internalName = this.internalName; + if (internalName == null) { + internalName = this.internalName = name.replace('.', '/'); + } + return internalName; + } + public byte[] getClassData() { return classData; } @@ -39,4 +70,7 @@ public String getSource() { return source; } + public String toString() { + return "GeneratedClassBuildItem[" + binaryName() + "]"; + } } diff --git a/extensions/smallrye-reactive-messaging-kafka/deployment/src/test/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/DefaultSerdeConfigTest.java b/extensions/smallrye-reactive-messaging-kafka/deployment/src/test/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/DefaultSerdeConfigTest.java index cc971ba643bcb..e0e5b9e4d437e 100644 --- a/extensions/smallrye-reactive-messaging-kafka/deployment/src/test/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/DefaultSerdeConfigTest.java +++ b/extensions/smallrye-reactive-messaging-kafka/deployment/src/test/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/DefaultSerdeConfigTest.java @@ -131,11 +131,12 @@ boolean isKafkaConnector(List list, boolean in }); assertThat(generated) - .extracting(GeneratedClassBuildItem::getName) + .extracting(GeneratedClassBuildItem::internalName) .allSatisfy(s -> assertThat(generatedNames).satisfiesOnlyOnce(c -> c.apply(s))); assertThat(reflective) .flatExtracting(ReflectiveClassBuildItem::getClassNames) + .extracting(n -> n.replace('/', '.')) .allSatisfy(s -> assertThat(reflectiveNames).satisfiesOnlyOnce(c -> c.apply(s))); } finally { // must not leak the lazily-initialized Config instance associated to the system classloader From c42f43f091308fa7cec92081a58ac8f7a8f2b057 Mon Sep 17 00:00:00 2001 From: Alexey Loubyansky Date: Tue, 26 Nov 2024 08:39:31 +0100 Subject: [PATCH 4/6] Doc: minor adjustment in an example configuring a conditional dependency --- docs/src/main/asciidoc/conditional-extension-dependencies.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/main/asciidoc/conditional-extension-dependencies.adoc b/docs/src/main/asciidoc/conditional-extension-dependencies.adoc index eeb1fac75896d..8bc1f4397a03c 100644 --- a/docs/src/main/asciidoc/conditional-extension-dependencies.adoc +++ b/docs/src/main/asciidoc/conditional-extension-dependencies.adoc @@ -166,7 +166,7 @@ Conditional dependencies can also be configured in the Quarkus extension descrip <3> - org.acme:quarkus-extension-b:${b.version} <4> + org.acme:quarkus-extension-b:${b.version} <4> From d59ea8fbccb9ee113b00dde24cf71e497fdccbaf Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Tue, 26 Nov 2024 10:09:57 +0100 Subject: [PATCH 5/6] Fix TLS config Javadoc typo Noticed while working on the management interface. --- .../java/io/quarkus/redis/runtime/client/config/TlsConfig.java | 2 +- .../java/io/quarkus/tls/runtime/config/TlsBucketConfig.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/runtime/client/config/TlsConfig.java b/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/runtime/client/config/TlsConfig.java index e8a6c46a75e95..55d83d4198d31 100644 --- a/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/runtime/client/config/TlsConfig.java +++ b/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/runtime/client/config/TlsConfig.java @@ -66,7 +66,7 @@ public interface TlsConfig { /** * The hostname verification algorithm to use in case the server's identity should be checked. - * Should be {@code HTTPS}, {@code LDAPS} or an {@code NONE} (default). + * Should be {@code HTTPS}, {@code LDAPS} or {@code NONE} (default). *

* If set to {@code NONE}, it does not verify the hostname. *

diff --git a/extensions/tls-registry/runtime/src/main/java/io/quarkus/tls/runtime/config/TlsBucketConfig.java b/extensions/tls-registry/runtime/src/main/java/io/quarkus/tls/runtime/config/TlsBucketConfig.java index a45c6aa0534be..47eab60a8def9 100644 --- a/extensions/tls-registry/runtime/src/main/java/io/quarkus/tls/runtime/config/TlsBucketConfig.java +++ b/extensions/tls-registry/runtime/src/main/java/io/quarkus/tls/runtime/config/TlsBucketConfig.java @@ -97,7 +97,7 @@ public interface TlsBucketConfig { /** * The hostname verification algorithm to use in case the server's identity should be checked. - * Should be {@code HTTPS} (default), {@code LDAPS} or an {@code NONE}. + * Should be {@code HTTPS} (default), {@code LDAPS} or {@code NONE}. *

* If set to {@code NONE}, it does not verify the hostname. *

From 622672c02f3f52e288bb406711967f885be7b078 Mon Sep 17 00:00:00 2001 From: xstefank Date: Tue, 26 Nov 2024 14:27:03 +0100 Subject: [PATCH 6/6] Fix leftover -reactive properties references in REST client guide --- docs/src/main/asciidoc/rest-client.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/src/main/asciidoc/rest-client.adoc b/docs/src/main/asciidoc/rest-client.adoc index c565f2328c955..5cb6e2b44395c 100644 --- a/docs/src/main/asciidoc/rest-client.adoc +++ b/docs/src/main/asciidoc/rest-client.adoc @@ -1340,7 +1340,7 @@ public class MyResponseExceptionMapper implements ResponseExceptionMapper