Hello Experts,
Based on experiences from implementing the config interfaces, I plan to push the following changes of the JAX-RS configuration API components into the origin master branch soon:
https://github.com/mpotociar/jax-rs/compare/config-api-take3
Here's a summary of the changes, including the reasons:
Main problems:
Custom contract priorities or partial contract registrations were not visible via getters
Mixing of immutable and mutable methods on two similar interfaces
Client-side Configurable interface seemed to be commonly reusable
Injected Configuration interface contained redundant setters
The registration rules are not aligned well with JAX-RS Application getters.
Proposed solution:
Transform Configuration interface into a read-only encapsulation of config state
Add missing information about custom/partial registrations to the Configuration interface
Make Configurable interface common and write-mostly concept
Expose Configuration via Configurable
Simplify component registration rules and improve javadoc.
Steps taken:
Configurable interface was moved from client to core package
Removed all config getters from the Configurable interface
Added a single new Configuration getter into Configurable interface
Removed all mutable methods from Configuration interface
Added missing getters to the Configuration interface
Some methods renamed to be shorter
Redesigned register(...) method to support full flexibility of custom contract registration.
Added a lot of clarifying API docs around configuration and introduced fixed rules for overriding registrations:
there can be only one (either class or instance-based) registration per component type
existing registrations cannot be overridden
this is important for DynamicFeature not screwing up global providers
Updated examples
Please, let me know if you have any other suggestions.
Thank you,
Marek