quarkus

CDI context in Kafka de-/serializer in Quarkus app

老子叫甜甜 提交于 2021-02-10 09:24:54
问题 I have a Quarkus project with Smallrye reactive messaging based on Kafka. Since I want to work with a "complex pojo" I need a custom de-/serializer. I'd like to make those two classes CDI beans so I can inject and use my custom logger, which is a CDI bean. Is there a way to achieve this? Right now my injected logger object is simply null: import org.apache.kafka.common.serialization.Serializer; import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; @ApplicationScoped

CDI context in Kafka de-/serializer in Quarkus app

别等时光非礼了梦想. 提交于 2021-02-10 09:24:51
问题 I have a Quarkus project with Smallrye reactive messaging based on Kafka. Since I want to work with a "complex pojo" I need a custom de-/serializer. I'd like to make those two classes CDI beans so I can inject and use my custom logger, which is a CDI bean. Is there a way to achieve this? Right now my injected logger object is simply null: import org.apache.kafka.common.serialization.Serializer; import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; @ApplicationScoped

Quarkus & Microprofile : Is there a better way to use a property from application.properties into @ClientHeaderParam?

孤街醉人 提交于 2021-02-07 14:34:21
问题 I'm trying to build a simple app that calls an API with quarkus-rest-client . I have to inject an API Key as a header which is the same for all resources of the API. So I would like to put the value of this API Key (that depends on the environment dev/qa/prod ) in the application.properties file located in src/main/resources . I tried different ways to achieve this: Use directly com.acme.Configuration.getKey into @ClientHeaderParam value property Create a StoresClientHeadersFactory class

Quarkus & Microprofile : Is there a better way to use a property from application.properties into @ClientHeaderParam?

一曲冷凌霜 提交于 2021-02-07 14:33:42
问题 I'm trying to build a simple app that calls an API with quarkus-rest-client . I have to inject an API Key as a header which is the same for all resources of the API. So I would like to put the value of this API Key (that depends on the environment dev/qa/prod ) in the application.properties file located in src/main/resources . I tried different ways to achieve this: Use directly com.acme.Configuration.getKey into @ClientHeaderParam value property Create a StoresClientHeadersFactory class

No instances of … are allowed in the image heap as this class should be initialized at image runtime

瘦欲@ 提交于 2021-02-07 04:22:55
问题 I am running a simple Java application (just a REST endpoint, a "Hello" response - exactly the example generated by the Quarkus maven archetype, without modification) with the following stack: Quarkus (MicroProfile) JDK 1.8 HotSpot 1.8.0_231-b11 GraalVM 19.3.0 (native-image) MacOS Catalina The first error it is (although it does'nt seems to be the main problem): [code-with-quarkus-1.0.0-SNAPSHOT-runner:1868] setup: 8,524.65 ms java.lang.NoSuchMethodException: com.oracle.svm.core.jdk

How do I log com.fasterxml.jackson errors with Quarkus?

走远了吗. 提交于 2021-02-05 09:27:43
问题 I use Jackson to check and databind input JSON for a REST API, and I would like to log the error when the input doesn’t match a @Valid constraint. However, the exceptions are throwned as a Response by the API but do not appear in Quarkus’ logs. How do I log Jackson’s exceptions ? 回答1: One has to create a handler for the Jackson exceptions, e.g. using ExceptionMapper. The following example catches all exceptions of type JsonProcessingException (finer tuning is obviously possible), logs them as

How do I log com.fasterxml.jackson errors with Quarkus?

Deadly 提交于 2021-02-05 09:27:11
问题 I use Jackson to check and databind input JSON for a REST API, and I would like to log the error when the input doesn’t match a @Valid constraint. However, the exceptions are throwned as a Response by the API but do not appear in Quarkus’ logs. How do I log Jackson’s exceptions ? 回答1: One has to create a handler for the Jackson exceptions, e.g. using ExceptionMapper. The following example catches all exceptions of type JsonProcessingException (finer tuning is obviously possible), logs them as

ClassCastException in multi-module project running on Quarkus (gradle)

空扰寡人 提交于 2021-01-29 16:36:42
问题 I seem the get weird classcast exceptions in multi-module project. Here is an shortened overview of the project structure: Project: dto-commons contains -> AuditingEntityObjectSelector (a normal java class) -> AbstractAuditingEntity (JPA @MappedSuperClass) Project: model contains lots of JPA entities, which all extend AbstractAuditingEntity from the project 'dto-commons' depends on -> dto-commons Project: selectors contains -> SampleRequestSelector (a normal java class which extends

ClassCastException in Quarkus multi-module project

筅森魡賤 提交于 2021-01-29 09:32:05
问题 My problem seems similar to ClassCastException in multi-module project running on Quarkus (gradle). I am using maven, though. I can confirm the problem do not occur when using the runner or in tests. I created a sample application to reproduce the issue in https://github.com/AmsterdamFilho/quarkus-poc. If you run the application in dev mode and execute the endpoint using swagger-ui or curl you get the Exception: Caused by: java.lang.ClassCastException: class br.com.quarkus.poc

Quarkus native and org.kohsuke:github-api - Failed to deserialize exception

江枫思渺然 提交于 2021-01-28 20:30:42
问题 I'm playing with Quarkus native and org.kohsuke:github-api:1.111 and I see Failed to deserialize exception in native mode when doing simple new GitHubBuilder().withOAuthToken(ghToken).build(); . This works in JVM mode. The main problem is probably the fact that org.kohsuke:github-api is not ready for native mode. I still want to ask if there are any options to workaround this, maybe some jackson tricks for https://github.com/github-api/github-api/blob/master/src/main/java/org/kohsuke/github