config icon indicating copy to clipboard operation
config copied to clipboard

Add support for all-args constructors in order to support immutable/value objects

Open Gaibhne opened this issue 6 years ago • 1 comments

As loaded configurations tend to be designed to be read, not changed, it makes sense to use immutable value objects ('beans' without setters and only an all-args-constructor) for them. Unfortunately, that doesn't seem to be possible with Config at the moment.

Adding support for this should be relatively trivial - when a bean without a no-args-constructor is detected, see if there is a constructor with a parameter for every field, and if there is, use that instead.

Gaibhne avatar Sep 26 '19 06:09 Gaibhne

There is ready PR for this feature: https://github.com/lightbend/config/pull/643

radist-nt avatar Jul 27 '20 23:07 radist-nt