-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20385 from radcortez/fix-19549
Add build steps to access the config builder at runtime
- Loading branch information
Showing
16 changed files
with
309 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...ployment/src/main/java/io/quarkus/deployment/builditem/RunTimeConfigBuilderBuildItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package io.quarkus.deployment.builditem; | ||
|
||
import io.quarkus.builder.item.MultiBuildItem; | ||
|
||
public final class RunTimeConfigBuilderBuildItem extends MultiBuildItem { | ||
private String builderClassName; | ||
|
||
public RunTimeConfigBuilderBuildItem(final String builderClassName) { | ||
this.builderClassName = builderClassName; | ||
} | ||
|
||
public String getBuilderClassName() { | ||
return builderClassName; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...yment/src/main/java/io/quarkus/deployment/builditem/StaticInitConfigBuilderBuildItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package io.quarkus.deployment.builditem; | ||
|
||
import io.quarkus.builder.item.MultiBuildItem; | ||
|
||
public final class StaticInitConfigBuilderBuildItem extends MultiBuildItem { | ||
private String builderClassName; | ||
|
||
public StaticInitConfigBuilderBuildItem(final String builderClassName) { | ||
this.builderClassName = builderClassName; | ||
} | ||
|
||
public String getBuilderClassName() { | ||
return builderClassName; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
core/runtime/src/main/java/io/quarkus/runtime/configuration/ConfigBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package io.quarkus.runtime.configuration; | ||
|
||
import io.smallrye.config.SmallRyeConfigBuilder; | ||
|
||
public interface ConfigBuilder { | ||
SmallRyeConfigBuilder configBuilder(SmallRyeConfigBuilder builder); | ||
|
||
default int priority() { | ||
return 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
core/test-extension/deployment/src/test/java/io/quarkus/config/ConfigBuilderTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package io.quarkus.config; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import javax.inject.Inject; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.extest.runtime.config.StaticInitConfigBuilder; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
import io.smallrye.config.SmallRyeConfig; | ||
|
||
public class ConfigBuilderTest { | ||
@RegisterExtension | ||
static final QuarkusUnitTest TEST = new QuarkusUnitTest() | ||
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)); | ||
|
||
@Inject | ||
SmallRyeConfig config; | ||
|
||
@Test | ||
void staticConfigBuilder() { | ||
assertEquals(1, StaticInitConfigBuilder.counter.get()); | ||
} | ||
|
||
@Test | ||
void runTimeConfigBuilder() { | ||
assertEquals("1234", config.getRawValue("additional.builder.property")); | ||
} | ||
} |
Oops, something went wrong.