forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure that ObjectMapperCustomizer impls are used in runtime init
Fixes: quarkusio#32969
- Loading branch information
Showing
9 changed files
with
91 additions
and
0 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
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
9 changes: 9 additions & 0 deletions
9
.../deployment/src/main/java/io/quarkus/vertx/deployment/ReinitializeVertxJsonBuildItem.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,9 @@ | ||
package io.quarkus.vertx.deployment; | ||
|
||
import io.quarkus.builder.item.MultiBuildItem; | ||
|
||
/** | ||
* Marker build item used to force the re-initialization of Vert.x JSON handling in native-image | ||
*/ | ||
public final class ReinitializeVertxJsonBuildItem extends MultiBuildItem { | ||
} |
27 changes: 27 additions & 0 deletions
27
...nsions/vertx/deployment/src/main/java/io/quarkus/vertx/deployment/VertxJsonProcessor.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,27 @@ | ||
package io.quarkus.vertx.deployment; | ||
|
||
import java.util.List; | ||
|
||
import io.quarkus.deployment.annotations.BuildProducer; | ||
import io.quarkus.deployment.annotations.BuildStep; | ||
import io.quarkus.deployment.builditem.nativeimage.RuntimeReinitializedClassBuildItem; | ||
import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem; | ||
import io.vertx.core.spi.JsonFactory; | ||
|
||
public class VertxJsonProcessor { | ||
|
||
@BuildStep | ||
void nativeSupport(List<ReinitializeVertxJsonBuildItem> reinitializeVertxJson, | ||
BuildProducer<RuntimeReinitializedClassBuildItem> runtimeReinitializedClassProducer, | ||
BuildProducer<ServiceProviderBuildItem> serviceProviderBuildItemBuildProducer) { | ||
if (reinitializeVertxJson.isEmpty()) { | ||
return; | ||
} | ||
runtimeReinitializedClassProducer | ||
.produce(new RuntimeReinitializedClassBuildItem(io.vertx.core.json.Json.class.getName())); | ||
runtimeReinitializedClassProducer | ||
.produce(new RuntimeReinitializedClassBuildItem("io.quarkus.vertx.runtime.jackson.QuarkusJacksonJsonCodec")); | ||
serviceProviderBuildItemBuildProducer | ||
.produce(ServiceProviderBuildItem.allProvidersFromClassPath(JsonFactory.class.getName())); | ||
} | ||
} |
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
15 changes: 15 additions & 0 deletions
15
.../src/main/kotlin/io/quarkus/it/resteasy/reactive/kotlin/RegisterCustomModuleCustomizer.kt
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.it.resteasy.reactive.kotlin | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper | ||
import io.quarkus.jackson.ObjectMapperCustomizer | ||
import jakarta.inject.Singleton | ||
import org.eclipse.microprofile.config.inject.ConfigProperty | ||
|
||
@Singleton | ||
class RegisterCustomModuleCustomizer : ObjectMapperCustomizer { | ||
@ConfigProperty(name = "test.prop") lateinit var testProp: String | ||
|
||
override fun customize(objectMapper: ObjectMapper) { | ||
GreetingResource.MY_PROPERTY.set(testProp) | ||
} | ||
} |
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