diff --git a/extensions/reactive-datasource/runtime/src/main/java/io/quarkus/reactive/datasource/runtime/DataSourcesReactiveBuildTimeConfig.java b/extensions/reactive-datasource/runtime/src/main/java/io/quarkus/reactive/datasource/runtime/DataSourcesReactiveBuildTimeConfig.java index 177b156266559..aae15f0cf3525 100644 --- a/extensions/reactive-datasource/runtime/src/main/java/io/quarkus/reactive/datasource/runtime/DataSourcesReactiveBuildTimeConfig.java +++ b/extensions/reactive-datasource/runtime/src/main/java/io/quarkus/reactive/datasource/runtime/DataSourcesReactiveBuildTimeConfig.java @@ -1,37 +1,59 @@ package io.quarkus.reactive.datasource.runtime; +import java.util.HashMap; import java.util.Map; import io.quarkus.datasource.common.runtime.DataSourceUtil; import io.quarkus.runtime.annotations.ConfigDocMapKey; -import io.quarkus.runtime.annotations.ConfigDocSection; import io.quarkus.runtime.annotations.ConfigGroup; import io.quarkus.runtime.annotations.ConfigPhase; import io.quarkus.runtime.annotations.ConfigRoot; import io.smallrye.config.ConfigMapping; import io.smallrye.config.WithDefaults; -import io.smallrye.config.WithName; import io.smallrye.config.WithParentName; +import io.smallrye.config.WithUnnamedKey; @ConfigMapping(prefix = "quarkus.datasource") @ConfigRoot(phase = ConfigPhase.BUILD_AND_RUN_TIME_FIXED) public interface DataSourcesReactiveBuildTimeConfig { + /** + * Datasources. + */ + @ConfigDocMapKey("datasource-name") + @WithParentName + @WithDefaults + @WithUnnamedKey(DataSourceUtil.DEFAULT_DATASOURCE_NAME) + Map dataSources(); + /** * The default datasource. + * + * @deprecated Use {@code dataSources().get(DataSourceUtil.DEFAULT_DATASOURCE_NAME).reactive()} instead. */ - @WithName("reactive") - DataSourceReactiveBuildTimeConfig defaultDataSource(); + @Deprecated + default DataSourceReactiveBuildTimeConfig defaultDataSource() { + return dataSources().get(DataSourceUtil.DEFAULT_DATASOURCE_NAME).reactive(); + } /** * Additional named datasources. + * + * @deprecated Use {@code dataSources()} instead -- this will include the default datasource. */ - @ConfigDocSection - @ConfigDocMapKey("datasource-name") - @WithParentName - @WithDefaults - Map namedDataSources(); + @Deprecated + default Map namedDataSources() { + Map withoutDefault = new HashMap<>(dataSources()); + withoutDefault.remove(DataSourceUtil.DEFAULT_DATASOURCE_NAME); + return withoutDefault; + } + /** + * Additional named datasources. + * + * @deprecated Use {@code dataSources().get(dataSourceName).reactive()} instead. + */ + @Deprecated default DataSourceReactiveBuildTimeConfig getDataSourceReactiveBuildTimeConfig(String dataSourceName) { if (DataSourceUtil.isDefault(dataSourceName)) { return defaultDataSource(); diff --git a/extensions/reactive-datasource/runtime/src/main/java/io/quarkus/reactive/datasource/runtime/DataSourcesReactiveRuntimeConfig.java b/extensions/reactive-datasource/runtime/src/main/java/io/quarkus/reactive/datasource/runtime/DataSourcesReactiveRuntimeConfig.java index 4d2243e74fc30..a3b3a42c0c2d7 100644 --- a/extensions/reactive-datasource/runtime/src/main/java/io/quarkus/reactive/datasource/runtime/DataSourcesReactiveRuntimeConfig.java +++ b/extensions/reactive-datasource/runtime/src/main/java/io/quarkus/reactive/datasource/runtime/DataSourcesReactiveRuntimeConfig.java @@ -1,37 +1,59 @@ package io.quarkus.reactive.datasource.runtime; +import java.util.HashMap; import java.util.Map; import io.quarkus.datasource.common.runtime.DataSourceUtil; import io.quarkus.runtime.annotations.ConfigDocMapKey; -import io.quarkus.runtime.annotations.ConfigDocSection; import io.quarkus.runtime.annotations.ConfigGroup; import io.quarkus.runtime.annotations.ConfigPhase; import io.quarkus.runtime.annotations.ConfigRoot; import io.smallrye.config.ConfigMapping; import io.smallrye.config.WithDefaults; -import io.smallrye.config.WithName; import io.smallrye.config.WithParentName; +import io.smallrye.config.WithUnnamedKey; @ConfigMapping(prefix = "quarkus.datasource") @ConfigRoot(phase = ConfigPhase.RUN_TIME) public interface DataSourcesReactiveRuntimeConfig { + /** + * Datasources. + */ + @ConfigDocMapKey("datasource-name") + @WithParentName + @WithDefaults + @WithUnnamedKey(DataSourceUtil.DEFAULT_DATASOURCE_NAME) + Map dataSources(); + /** * The default datasource. + * + * @deprecated Use {@code dataSources().get(DataSourceUtil.DEFAULT_DATASOURCE_NAME).reactive()} instead. */ - @WithName("reactive") - DataSourceReactiveRuntimeConfig defaultDataSource(); + @Deprecated + default DataSourceReactiveRuntimeConfig defaultDataSource() { + return dataSources().get(DataSourceUtil.DEFAULT_DATASOURCE_NAME).reactive(); + } /** * Additional named datasources. + * + * @deprecated Use {@code dataSources()} instead -- this will include the default datasource. */ - @ConfigDocSection - @ConfigDocMapKey("datasource-name") - @WithParentName - @WithDefaults - Map namedDataSources(); + @Deprecated + default Map namedDataSources() { + Map withoutDefault = new HashMap<>(dataSources()); + withoutDefault.remove(DataSourceUtil.DEFAULT_DATASOURCE_NAME); + return withoutDefault; + } + /** + * Additional named datasources. + * + * @deprecated Use {@code dataSources().get(dataSourceName).reactive()} instead. + */ + @Deprecated default DataSourceReactiveRuntimeConfig getDataSourceReactiveRuntimeConfig(String dataSourceName) { if (DataSourceUtil.isDefault(dataSourceName)) { return defaultDataSource(); diff --git a/extensions/reactive-db2-client/deployment/src/main/java/io/quarkus/reactive/db2/client/deployment/ReactiveDB2ClientProcessor.java b/extensions/reactive-db2-client/deployment/src/main/java/io/quarkus/reactive/db2/client/deployment/ReactiveDB2ClientProcessor.java index 1c4a185b019ba..a56deb4a8ecec 100644 --- a/extensions/reactive-db2-client/deployment/src/main/java/io/quarkus/reactive/db2/client/deployment/ReactiveDB2ClientProcessor.java +++ b/extensions/reactive-db2-client/deployment/src/main/java/io/quarkus/reactive/db2/client/deployment/ReactiveDB2ClientProcessor.java @@ -253,7 +253,7 @@ private static boolean isReactiveDB2PoolDefined(DataSourcesBuildTimeConfig dataS DataSourceBuildTimeConfig dataSourceBuildTimeConfig = dataSourcesBuildTimeConfig .dataSources().get(dataSourceName); DataSourceReactiveBuildTimeConfig dataSourceReactiveBuildTimeConfig = dataSourcesReactiveBuildTimeConfig - .getDataSourceReactiveBuildTimeConfig(dataSourceName); + .dataSources().get(dataSourceName).reactive(); Optional dbKind = DefaultDataSourceDbKindBuildItem.resolve(dataSourceBuildTimeConfig.dbKind(), defaultDataSourceDbKindBuildItems, diff --git a/extensions/reactive-db2-client/runtime/src/main/java/io/quarkus/reactive/db2/client/runtime/DB2PoolRecorder.java b/extensions/reactive-db2-client/runtime/src/main/java/io/quarkus/reactive/db2/client/runtime/DB2PoolRecorder.java index b9fb3a361541d..df15e717770c0 100644 --- a/extensions/reactive-db2-client/runtime/src/main/java/io/quarkus/reactive/db2/client/runtime/DB2PoolRecorder.java +++ b/extensions/reactive-db2-client/runtime/src/main/java/io/quarkus/reactive/db2/client/runtime/DB2PoolRecorder.java @@ -66,7 +66,7 @@ public DB2Pool apply(SyntheticCreationalContext context) { eventLoopCount.get(), dataSourceName, dataSourcesRuntimeConfig.dataSources().get(dataSourceName), - dataSourcesReactiveRuntimeConfig.getDataSourceReactiveRuntimeConfig(dataSourceName), + dataSourcesReactiveRuntimeConfig.dataSources().get(dataSourceName).reactive(), dataSourcesReactiveDB2Config.dataSources().get(dataSourceName).reactive().db2(), context); diff --git a/extensions/reactive-mssql-client/deployment/src/main/java/io/quarkus/reactive/mssql/client/deployment/ReactiveMSSQLClientProcessor.java b/extensions/reactive-mssql-client/deployment/src/main/java/io/quarkus/reactive/mssql/client/deployment/ReactiveMSSQLClientProcessor.java index 0ca0afbd230c1..f181091fd72f8 100644 --- a/extensions/reactive-mssql-client/deployment/src/main/java/io/quarkus/reactive/mssql/client/deployment/ReactiveMSSQLClientProcessor.java +++ b/extensions/reactive-mssql-client/deployment/src/main/java/io/quarkus/reactive/mssql/client/deployment/ReactiveMSSQLClientProcessor.java @@ -251,7 +251,7 @@ private static boolean isReactiveMSSQLPoolDefined(DataSourcesBuildTimeConfig dat DataSourceBuildTimeConfig dataSourceBuildTimeConfig = dataSourcesBuildTimeConfig .dataSources().get(dataSourceName); DataSourceReactiveBuildTimeConfig dataSourceReactiveBuildTimeConfig = dataSourcesReactiveBuildTimeConfig - .getDataSourceReactiveBuildTimeConfig(dataSourceName); + .dataSources().get(dataSourceName).reactive(); Optional dbKind = DefaultDataSourceDbKindBuildItem.resolve(dataSourceBuildTimeConfig.dbKind(), defaultDataSourceDbKindBuildItems, diff --git a/extensions/reactive-mssql-client/runtime/src/main/java/io/quarkus/reactive/mssql/client/runtime/MSSQLPoolRecorder.java b/extensions/reactive-mssql-client/runtime/src/main/java/io/quarkus/reactive/mssql/client/runtime/MSSQLPoolRecorder.java index adb8205af7c31..5e83d38e83701 100644 --- a/extensions/reactive-mssql-client/runtime/src/main/java/io/quarkus/reactive/mssql/client/runtime/MSSQLPoolRecorder.java +++ b/extensions/reactive-mssql-client/runtime/src/main/java/io/quarkus/reactive/mssql/client/runtime/MSSQLPoolRecorder.java @@ -71,7 +71,7 @@ public MSSQLPool apply(SyntheticCreationalContext context) { eventLoopCount.get(), dataSourceName, dataSourcesRuntimeConfig.dataSources().get(dataSourceName), - dataSourcesReactiveRuntimeConfig.getDataSourceReactiveRuntimeConfig(dataSourceName), + dataSourcesReactiveRuntimeConfig.dataSources().get(dataSourceName).reactive(), dataSourcesReactiveMSSQLConfig.dataSources().get(dataSourceName).reactive().mssql(), context); diff --git a/extensions/reactive-mysql-client/deployment/src/main/java/io/quarkus/reactive/mysql/client/deployment/ReactiveMySQLClientProcessor.java b/extensions/reactive-mysql-client/deployment/src/main/java/io/quarkus/reactive/mysql/client/deployment/ReactiveMySQLClientProcessor.java index 30c8cbdbb8367..e2e679dfc042c 100644 --- a/extensions/reactive-mysql-client/deployment/src/main/java/io/quarkus/reactive/mysql/client/deployment/ReactiveMySQLClientProcessor.java +++ b/extensions/reactive-mysql-client/deployment/src/main/java/io/quarkus/reactive/mysql/client/deployment/ReactiveMySQLClientProcessor.java @@ -252,7 +252,7 @@ private static boolean isReactiveMySQLPoolDefined(DataSourcesBuildTimeConfig dat DataSourceBuildTimeConfig dataSourceBuildTimeConfig = dataSourcesBuildTimeConfig .dataSources().get(dataSourceName); DataSourceReactiveBuildTimeConfig dataSourceReactiveBuildTimeConfig = dataSourcesReactiveBuildTimeConfig - .getDataSourceReactiveBuildTimeConfig(dataSourceName); + .dataSources().get(dataSourceName).reactive(); Optional dbKind = DefaultDataSourceDbKindBuildItem.resolve(dataSourceBuildTimeConfig.dbKind(), defaultDataSourceDbKindBuildItems, diff --git a/extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/MySQLPoolRecorder.java b/extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/MySQLPoolRecorder.java index b5dd0a518b249..87e331c35dd5f 100644 --- a/extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/MySQLPoolRecorder.java +++ b/extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/MySQLPoolRecorder.java @@ -66,7 +66,7 @@ public MySQLPool apply(SyntheticCreationalContext context) { eventLoopCount.get(), dataSourceName, dataSourcesRuntimeConfig.dataSources().get(dataSourceName), - dataSourcesReactiveRuntimeConfig.getDataSourceReactiveRuntimeConfig(dataSourceName), + dataSourcesReactiveRuntimeConfig.dataSources().get(dataSourceName).reactive(), dataSourcesReactiveMySQLConfig.dataSources().get(dataSourceName).reactive().mysql(), context); diff --git a/extensions/reactive-oracle-client/deployment/src/main/java/io/quarkus/reactive/oracle/client/deployment/ReactiveOracleClientProcessor.java b/extensions/reactive-oracle-client/deployment/src/main/java/io/quarkus/reactive/oracle/client/deployment/ReactiveOracleClientProcessor.java index 6e4ff69b02225..0ad7ba26e1887 100644 --- a/extensions/reactive-oracle-client/deployment/src/main/java/io/quarkus/reactive/oracle/client/deployment/ReactiveOracleClientProcessor.java +++ b/extensions/reactive-oracle-client/deployment/src/main/java/io/quarkus/reactive/oracle/client/deployment/ReactiveOracleClientProcessor.java @@ -253,7 +253,7 @@ private static boolean isReactiveOraclePoolDefined(DataSourcesBuildTimeConfig da DataSourceBuildTimeConfig dataSourceBuildTimeConfig = dataSourcesBuildTimeConfig .dataSources().get(dataSourceName); DataSourceReactiveBuildTimeConfig dataSourceReactiveBuildTimeConfig = dataSourcesReactiveBuildTimeConfig - .getDataSourceReactiveBuildTimeConfig(dataSourceName); + .dataSources().get(dataSourceName).reactive(); Optional dbKind = DefaultDataSourceDbKindBuildItem.resolve(dataSourceBuildTimeConfig.dbKind(), defaultDataSourceDbKindBuildItems, diff --git a/extensions/reactive-oracle-client/runtime/src/main/java/io/quarkus/reactive/oracle/client/runtime/OraclePoolRecorder.java b/extensions/reactive-oracle-client/runtime/src/main/java/io/quarkus/reactive/oracle/client/runtime/OraclePoolRecorder.java index b33346cb154e5..6e3b9a831fe83 100644 --- a/extensions/reactive-oracle-client/runtime/src/main/java/io/quarkus/reactive/oracle/client/runtime/OraclePoolRecorder.java +++ b/extensions/reactive-oracle-client/runtime/src/main/java/io/quarkus/reactive/oracle/client/runtime/OraclePoolRecorder.java @@ -62,7 +62,7 @@ public OraclePool apply(SyntheticCreationalContext context) { eventLoopCount.get(), dataSourceName, dataSourcesRuntimeConfig.dataSources().get(dataSourceName), - dataSourcesReactiveRuntimeConfig.getDataSourceReactiveRuntimeConfig(dataSourceName), + dataSourcesReactiveRuntimeConfig.dataSources().get(dataSourceName).reactive(), dataSourcesReactiveOracleConfig.dataSources().get(dataSourceName).reactive().oracle(), context); diff --git a/extensions/reactive-pg-client/deployment/src/main/java/io/quarkus/reactive/pg/client/deployment/ReactivePgClientProcessor.java b/extensions/reactive-pg-client/deployment/src/main/java/io/quarkus/reactive/pg/client/deployment/ReactivePgClientProcessor.java index d8b83bcaf3408..66894cc1fc4b6 100644 --- a/extensions/reactive-pg-client/deployment/src/main/java/io/quarkus/reactive/pg/client/deployment/ReactivePgClientProcessor.java +++ b/extensions/reactive-pg-client/deployment/src/main/java/io/quarkus/reactive/pg/client/deployment/ReactivePgClientProcessor.java @@ -258,7 +258,7 @@ private static boolean isReactivePostgreSQLPoolDefined(DataSourcesBuildTimeConfi DataSourceBuildTimeConfig dataSourceBuildTimeConfig = dataSourcesBuildTimeConfig .dataSources().get(dataSourceName); DataSourceReactiveBuildTimeConfig dataSourceReactiveBuildTimeConfig = dataSourcesReactiveBuildTimeConfig - .getDataSourceReactiveBuildTimeConfig(dataSourceName); + .dataSources().get(dataSourceName).reactive(); Optional dbKind = DefaultDataSourceDbKindBuildItem.resolve(dataSourceBuildTimeConfig.dbKind(), defaultDataSourceDbKindBuildItems, diff --git a/extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/PgPoolRecorder.java b/extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/PgPoolRecorder.java index 2dacfe32dcfa3..0658058a59d21 100644 --- a/extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/PgPoolRecorder.java +++ b/extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/PgPoolRecorder.java @@ -65,7 +65,7 @@ public PgPool apply(SyntheticCreationalContext context) { eventLoopCount.get(), dataSourceName, dataSourcesRuntimeConfig.dataSources().get(dataSourceName), - dataSourcesReactiveRuntimeConfig.getDataSourceReactiveRuntimeConfig(dataSourceName), + dataSourcesReactiveRuntimeConfig.dataSources().get(dataSourceName).reactive(), dataSourcesReactivePostgreSQLConfig.dataSources().get(dataSourceName).reactive().postgresql(), context);