eclipse-ee4j / eclipse-ee4j/jersey

Jsonb still not injectable

Open
#5,697 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
730
Forks
382
PR merge metrics
No merged PRs in 30d

Description

The example project: https://github.com/hantsy/jakartaee11-sandbox/tree/master/rest

* Java: 21
* Glassfish v8.0.0-M6 built-in Jersey

I have created a `@Provider` described like this:

```java
@Provider
public class JsonbContextResolver implements ContextResolver {
@Override
public Jsonb getContext(Class type) {
JsonbConfig config = new JsonbConfig()
.withPropertyNamingStrategy(PropertyNamingStrategy.LOWER_CASE_WITH_UNDERSCORES)
.withFormatting(true)
.withNullValues(false);
return JsonbBuilder.newBuilder().withConfig(config).build();
}
}

```

As discussed in here, https://github.com/jakartaee/rest/issues/742, a `Jsonb` instance should be available in the context.

```java
@Inject Jsonb jsonb;
```

I tried to inject `Jsonb`, failed.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.