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

Move log4j-api to correct quarkus module and add condition for jackson-module-jaxb-annotations registrations #30018

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
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.ExtensionSslNativeSupportBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;

class ElasticsearchRestClientProcessor {

Expand All @@ -14,10 +13,4 @@ public void build(BuildProducer<ExtensionSslNativeSupportBuildItem> extensionSsl
extensionSslNativeSupport.produce(new ExtensionSslNativeSupportBuildItem(Feature.ELASTICSEARCH_REST_CLIENT_COMMON));
}

@BuildStep
public ReflectiveClassBuildItem registerForReflection() {
return new ReflectiveClassBuildItem(true, true,
"org.apache.logging.log4j.message.ReusableMessageFactory",
"org.apache.logging.log4j.message.DefaultFlowMessageFactory");
}
yrodiere marked this conversation as resolved.
Show resolved Hide resolved
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import io.quarkus.deployment.Feature;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import io.quarkus.elasticsearch.restclient.highlevel.runtime.ElasticsearchRestHighLevelClientProducer;

class ElasticsearchHighLevelClientProcessor {
Expand All @@ -18,4 +19,11 @@ AdditionalBeanBuildItem build() {
return AdditionalBeanBuildItem.unremovableOf(ElasticsearchRestHighLevelClientProducer.class);
}

@BuildStep
public ReflectiveClassBuildItem registerForReflection() {
return new ReflectiveClassBuildItem(true, false,
"org.apache.logging.log4j.message.ReusableMessageFactory",
"org.apache.logging.log4j.message.DefaultFlowMessageFactory");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveHierarchyBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveMethodBuildItem;
import io.quarkus.deployment.pkg.builditem.CurateOutcomeBuildItem;
import io.quarkus.gizmo.ClassCreator;
import io.quarkus.gizmo.ClassOutput;
import io.quarkus.gizmo.MethodCreator;
Expand Down Expand Up @@ -113,18 +114,26 @@ void unremovable(Capabilities capabilities, BuildProducer<UnremovableBeanBuildIt

@BuildStep
void register(
CurateOutcomeBuildItem curateOutcomeBuildItem,
BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
BuildProducer<ReflectiveHierarchyBuildItem> reflectiveHierarchyClass,
BuildProducer<ReflectiveMethodBuildItem> reflectiveMethod,
BuildProducer<AdditionalBeanBuildItem> additionalBeans) {
reflectiveClass.produce(
new ReflectiveClassBuildItem(true, false, "com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector",
new ReflectiveClassBuildItem(true, false,
"com.fasterxml.jackson.databind.ser.std.SqlDateSerializer",
"com.fasterxml.jackson.databind.ser.std.SqlTimeSerializer",
"com.fasterxml.jackson.databind.deser.std.DateDeserializers$SqlDateDeserializer",
"com.fasterxml.jackson.databind.deser.std.DateDeserializers$TimestampDeserializer",
"com.fasterxml.jackson.annotation.SimpleObjectIdResolver"));

if (curateOutcomeBuildItem.getApplicationModel().getDependencies().stream().anyMatch(
x -> x.getGroupId().equals("com.fasterxml.jackson.module")
&& x.getArtifactId().equals("jackson-module-jaxb-annotations"))) {
Comment on lines +131 to +132
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know I've asked elsewhere too so apologies for that, but did we reach a consensus about this pattern?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like there is no better way at the moment (see #29886 (comment))

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

reflectiveClass.produce(
new ReflectiveClassBuildItem(true, false, "com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector"));
}

IndexView index = combinedIndexBuildItem.getIndex();

// TODO: @JsonDeserialize is only supported as a class annotation - we should support the others as well
Expand Down