Skip to content

Commit

Permalink
Do not discover properties resource in the classpath since they are a…
Browse files Browse the repository at this point in the history
…lready recorded during build time
  • Loading branch information
radcortez committed Dec 3, 2024
1 parent 57f0e20 commit 74e2236
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package io.quarkus.runtime.configuration;

import static io.smallrye.config.PropertiesConfigSourceLoader.inFileSystem;

import java.nio.file.Paths;
import java.util.UUID;

import io.smallrye.config.SmallRyeConfigBuilder;
Expand All @@ -14,13 +17,20 @@ public void configBuilder(final SmallRyeConfigBuilder builder) {
new QuarkusConfigBuilderCustomizer().configBuilder(builder);
builder.withDefaultValue("quarkus.uuid", UUID.randomUUID().toString());

builder.forClassLoader(Thread.currentThread().getContextClassLoader())
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
builder.forClassLoader(classLoader)
.addDefaultInterceptors()
.addDefaultSources();
.addSystemSources();

if (!builder.isAddDefaultSources() && !builder.isAddPropertiesSources()) {
builder.withSources(inFileSystem(
Paths.get(System.getProperty("user.dir"), "config", "application.properties").toUri().toString(), 260,
classLoader));
}
}

@Override
public int priority() {
return Integer.MIN_VALUE;
return Integer.MIN_VALUE + 10;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package io.quarkus.runtime.configuration;

import static io.smallrye.config.PropertiesConfigSourceLoader.inFileSystem;

import java.nio.file.Paths;

import io.smallrye.config.SmallRyeConfigBuilder;
import io.smallrye.config.SmallRyeConfigBuilderCustomizer;

Expand All @@ -11,13 +15,20 @@ public class StaticInitConfigBuilder implements SmallRyeConfigBuilderCustomizer
public void configBuilder(final SmallRyeConfigBuilder builder) {
new QuarkusConfigBuilderCustomizer().configBuilder(builder);

builder.forClassLoader(Thread.currentThread().getContextClassLoader())
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
builder.forClassLoader(classLoader)
.addDefaultInterceptors()
.addDefaultSources();
.addSystemSources();

if (!builder.isAddDefaultSources() && !builder.isAddPropertiesSources()) {
builder.withSources(inFileSystem(
Paths.get(System.getProperty("user.dir"), "config", "application.properties").toUri().toString(), 260,
classLoader));
}
}

@Override
public int priority() {
return Integer.MIN_VALUE;
return Integer.MIN_VALUE + 10;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package io.quarkus.test;

import io.quarkus.runtime.annotations.StaticInitSafe;
import io.smallrye.config.SmallRyeConfigBuilder;
import io.smallrye.config.SmallRyeConfigBuilderCustomizer;

@StaticInitSafe
public class TestConfigBuilderCustomizer implements SmallRyeConfigBuilderCustomizer {
@Override
public void configBuilder(final SmallRyeConfigBuilder builder) {
builder.addPropertiesSources();
}

@Override
public int priority() {
return Integer.MIN_VALUE;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
io.quarkus.test.TestConfigBuilderCustomizer

0 comments on commit 74e2236

Please sign in to comment.