Skip to content

Commit cfa2677

Browse files
authored
Merge pull request #45166 from mcruzdev/config-jaxb
Convert jaxb to use @ConfigMapping
2 parents 0396c33 + 83e6e85 commit cfa2677

File tree

4 files changed

+11
-16
lines changed

4 files changed

+11
-16
lines changed

extensions/jaxb/deployment/pom.xml

-3
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@
5656
<version>${project.version}</version>
5757
</path>
5858
</annotationProcessorPaths>
59-
<compilerArgs>
60-
<arg>-AlegacyConfigRoot=true</arg>
61-
</compilerArgs>
6259
</configuration>
6360
</execution>
6461
</executions>

extensions/jaxb/deployment/src/main/java/io/quarkus/jaxb/deployment/JaxbProcessor.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,8 @@ FilteredJaxbClassesToBeBoundBuildItem filterBoundClasses(
342342
.forEach(builder::classNames);
343343

344344
// remove classes that have been excluded by users
345-
if (config.excludeClasses.isPresent()) {
346-
builder.classNameExcludes(config.excludeClasses.get());
345+
if (config.excludeClasses().isPresent()) {
346+
builder.classNameExcludes(config.excludeClasses().get());
347347
}
348348
return builder.build();
349349
}
@@ -362,7 +362,7 @@ void bindClassesToJaxbContext(
362362
.resolveBeans(Type.create(DotName.createSimple(JAXBContext.class), org.jboss.jandex.Type.Kind.CLASS));
363363
if (!beans.isEmpty()) {
364364
jaxbContextConfig.addClassesToBeBound(filteredClassesToBeBound.getClasses());
365-
if (config.validateJaxbContext) {
365+
if (config.validateJaxbContext()) {
366366
validateJaxbContext(filteredClassesToBeBound, beanResolver, beans);
367367
}
368368
}

extensions/jaxb/runtime/pom.xml

-3
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@
7171
<version>${project.version}</version>
7272
</path>
7373
</annotationProcessorPaths>
74-
<compilerArgs>
75-
<arg>-AlegacyConfigRoot=true</arg>
76-
</compilerArgs>
7774
</configuration>
7875
</execution>
7976
</executions>

extensions/jaxb/runtime/src/main/java/io/quarkus/jaxb/runtime/JaxbConfig.java

+8-7
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,25 @@
33
import java.util.List;
44
import java.util.Optional;
55

6-
import io.quarkus.runtime.annotations.ConfigItem;
76
import io.quarkus.runtime.annotations.ConfigPhase;
87
import io.quarkus.runtime.annotations.ConfigRoot;
8+
import io.smallrye.config.ConfigMapping;
9+
import io.smallrye.config.WithDefault;
910

10-
@ConfigRoot(phase = ConfigPhase.BUILD_AND_RUN_TIME_FIXED, name = "jaxb")
11-
public class JaxbConfig {
11+
@ConfigRoot(phase = ConfigPhase.BUILD_AND_RUN_TIME_FIXED)
12+
@ConfigMapping(prefix = "quarkus.jaxb")
13+
public interface JaxbConfig {
1214

1315
/**
1416
* If enabled, it will validate the default JAXB context at build time.
1517
*/
16-
@ConfigItem(defaultValue = "false")
17-
public boolean validateJaxbContext;
18+
@WithDefault("false")
19+
boolean validateJaxbContext();
1820

1921
/**
2022
* Exclude classes to automatically be bound to the default JAXB context.
2123
* Values with suffix {@code .*}, i.e. {@code org.acme.*}, are considered packages and exclude all classes that are members
2224
* of these packages
2325
*/
24-
@ConfigItem
25-
public Optional<List<String>> excludeClasses;
26+
Optional<List<String>> excludeClasses();
2627
}

0 commit comments

Comments
 (0)