Skip to content

Commit a675f4f

Browse files
metacosmgsmet
authored andcommitted
Do not apply config provider if not set
(cherry picked from commit 5d1dc3e)
1 parent 1b99fdc commit a675f4f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

core/deployment/src/main/java/io/quarkus/deployment/builditem/DevServicesResultBuildItem.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,10 @@ public Map<String, String> getConfig(Startable startable) {
178178
if (config != null && !config.isEmpty()) {
179179
map.putAll(config);
180180
}
181-
for (Map.Entry<String, Function<Startable, String>> entry : applicationConfigProvider.entrySet()) {
182-
map.put(entry.getKey(), () -> entry.getValue().apply(startable));
181+
if (applicationConfigProvider != null) {
182+
for (Map.Entry<String, Function<Startable, String>> entry : applicationConfigProvider.entrySet()) {
183+
map.put(entry.getKey(), () -> entry.getValue().apply(startable));
184+
}
183185
}
184186
return map;
185187
}
@@ -263,6 +265,7 @@ public OwnedServiceBuilder<T> serviceConfig(Object serviceConfig) {
263265
return this;
264266
}
265267

268+
@SuppressWarnings("unchecked")
266269
public <S extends Startable> OwnedServiceBuilder<S> startable(Supplier<S> startableSupplier) {
267270
this.startableSupplier = startableSupplier;
268271
return (OwnedServiceBuilder<S>) this;
@@ -273,11 +276,13 @@ public OwnedServiceBuilder<T> postStartHook(Consumer<T> postStartAction) {
273276
return this;
274277
}
275278

279+
@SuppressWarnings({ "unchecked", "rawtypes" })
276280
public OwnedServiceBuilder<T> configProvider(Map<String, Function<T, String>> applicationConfigProvider) {
277281
this.applicationConfigProvider = (Map<String, Function<Startable, String>>) (Map) applicationConfigProvider;
278282
return this;
279283
}
280284

285+
@SuppressWarnings("unchecked")
281286
public DevServicesResultBuildItem build() {
282287
return new DevServicesResultBuildItem(name, description, serviceName, serviceConfig, config,
283288
(Supplier<Startable>) startableSupplier,

0 commit comments

Comments
 (0)