You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<1> The `Config` object is created with default settings.
110
110
111
+
=== Global Configuration
112
+
113
+
Global configuration is a singleton instance of `Config` that is implicitly used by some components of Helidon, plus it provides a convenient mechanism for your application to retrieve configuration from anywhere in your code.
114
+
By default global configuration is initialized to the default `Config` object (as returned by `Config.create()`). But it is recommended that you initialize it explicitly. This is especially important if you define custom config sources.
115
+
116
+
```
117
+
Config config = Config.create(); // <1>
118
+
Config.global(config); // <2>
119
+
```
120
+
<1> Create configuration. This shows creating the default config, but it could be created from custom config sources.
121
+
<2> Assign it to the application's global configuration
122
+
123
+
You can use global configuration to conveniently retrieve the application's configuration:
124
+
125
+
```
126
+
Config config = Config.global();
127
+
```
128
+
111
129
=== Custom Config Sources
112
130
113
131
Although the default configuration is very simple to use, your application can take full control of all configuration sources and precedence. You can do so by creating and invoking methods on a `Config.Builder` object to construct a `Config` instance.
0 commit comments