Static resolver in ConfigProvider

34 views
Skip to first unread message

Leo Jesuraj

unread,
Nov 14, 2017, 10:36:07 AM11/14/17
to Eclipse MicroProfile
Hello everyone,

I am fairly new to MicroProfile, so please excuse me if this was discussed before elsewhere (I did try searching through the forum, but didn't find the answers). I am currently working on microprofile-open-api. So I have been looking through some of the MP repos to understand the code as well as to use some design patterns to maintain consistency.

Within MP Config, the ConfigProvider class contains a static variable of ConfigProviderResolver type - which is later used to retrieve the Config. 

private static final ConfigProviderResolver INSTANCE = ConfigProviderResolver.instance();

(1) Does this mean that within an environment/server, it is restricted to having only one implementation of ConfigProviderResolver? 
(2) If so, a consumer/user can't (or not allowed to) bring-in another implementation (for some reasons)?

I am trying to understand the restrictions (if any) and the reasons behind the static pattern.

Thank you.

Mark Struberg

unread,
Nov 14, 2017, 2:25:16 PM11/14/17
to Eclipse MicroProfile
Yes, one ConfigProviderResolver. But this implentation typically returns different Config instances per application.
Note that a ConfigProviderResolver might also implement kind of 'proxying' to implement the wildest stuff you want. 

The one thing which really counts is the Config. The behaviour of the ConfigProviderResolver is pretty much defined by the spec anyway.

LieGrue,
strub
Reply all
Reply to author
Forward
0 new messages