Skip to content

Commit

Permalink
Convert jaxb to use @ConfigMapping
Browse files Browse the repository at this point in the history
  • Loading branch information
mcruzdev committed Dec 17, 2024
1 parent 0396c33 commit 83e6e85
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 16 deletions.
3 changes: 0 additions & 3 deletions extensions/jaxb/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@
<version>${project.version}</version>
</path>
</annotationProcessorPaths>
<compilerArgs>
<arg>-AlegacyConfigRoot=true</arg>
</compilerArgs>
</configuration>
</execution>
</executions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,8 @@ FilteredJaxbClassesToBeBoundBuildItem filterBoundClasses(
.forEach(builder::classNames);

// remove classes that have been excluded by users
if (config.excludeClasses.isPresent()) {
builder.classNameExcludes(config.excludeClasses.get());
if (config.excludeClasses().isPresent()) {
builder.classNameExcludes(config.excludeClasses().get());
}
return builder.build();
}
Expand All @@ -362,7 +362,7 @@ void bindClassesToJaxbContext(
.resolveBeans(Type.create(DotName.createSimple(JAXBContext.class), org.jboss.jandex.Type.Kind.CLASS));
if (!beans.isEmpty()) {
jaxbContextConfig.addClassesToBeBound(filteredClassesToBeBound.getClasses());
if (config.validateJaxbContext) {
if (config.validateJaxbContext()) {
validateJaxbContext(filteredClassesToBeBound, beanResolver, beans);
}
}
Expand Down
3 changes: 0 additions & 3 deletions extensions/jaxb/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@
<version>${project.version}</version>
</path>
</annotationProcessorPaths>
<compilerArgs>
<arg>-AlegacyConfigRoot=true</arg>
</compilerArgs>
</configuration>
</execution>
</executions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,25 @@
import java.util.List;
import java.util.Optional;

import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;
import io.smallrye.config.ConfigMapping;
import io.smallrye.config.WithDefault;

@ConfigRoot(phase = ConfigPhase.BUILD_AND_RUN_TIME_FIXED, name = "jaxb")
public class JaxbConfig {
@ConfigRoot(phase = ConfigPhase.BUILD_AND_RUN_TIME_FIXED)
@ConfigMapping(prefix = "quarkus.jaxb")
public interface JaxbConfig {

/**
* If enabled, it will validate the default JAXB context at build time.
*/
@ConfigItem(defaultValue = "false")
public boolean validateJaxbContext;
@WithDefault("false")
boolean validateJaxbContext();

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

0 comments on commit 83e6e85

Please sign in to comment.