Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert jaxb to use @ConfigMapping #45166

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
}
Loading