jakartaee / jakartaee/jsonb-api
Use MP/Jakarta Config for default JsonbConfig configuration
- Dominant language
- Java
- Stars
- 95
- Forks
- 41
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 35
Description
It should be possible to configure default values for `JsonbConfig` instances using MP/Jakarta config.
For example, if an application initialized a default JSON-B configuration like this:
```jav
new JsonbConfig()
```
With the properties:
```
jsonb.formatting=true
jsonb.encoding=UTF-16
```
It would be equivalent to specifying the following:
```java
new JsonbConfig()
.withFormatting(true)
.withEncoding("UTF-16");
```
If a JsonbConfig explicitly defines a configuration value, it takes precedence over any MP/JEE Config values. For example, using the same properties file above, and the following code:
```java
new JsonbConfig()
.withEncoding("UTF-32");
```
The resulting properties would be `encoding=UTF-32` (explicitly defined) and `formatting=true` (from MP/JEE Config)
Configuration that requires instances of classes could also be supported, for example:
```
jsonb.adapters=com.example.MyAdapter,com.example.FooAdapter
jsonb.propertyVisibilityStrategy=com.example.MyVisibilityStrategy
```
For these cases, it would be required that the referenced classes have default constructors in order to be globally configured via MP/JEE Config. If they do not have default public constructors, an error would be thrown.
NOTE: Jakarta Config is not an official spec yet, but it is being proposed for Jakarta EE 9
Contributor guide
Research direction
Start with the JsonbConfig entry point and the configuration examples in this issue, then review the status of Jakarta Config, which is noted as not yet an official specification. Define the supported default properties, explicit-value precedence, and handling of configured class instances. Done means the behavior and API are agreed and specified for implementation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100