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
@ConfigBean("ft.asyncs") // read it from ft.asyncs node, repeatable
AsyncConfig {..}
@ConfigBean("ft.bulheads") // read it from ft.bulkheads node, repeatable
BulkheadConfig {..}
@ConfigBean(value = "server", repeatable = false) // read it from server, not repeatable
ServerConfig {...}
When processing, the code to create the beans should be similar to this pseudo:
Config config; // located at the node of the config bean, such as `ft.asyncs`
if (configBeanAnnotation.repeatable()) {
if (config.isList()) {
- each node in the list is a config bean instance, named by the index (config.key().name()), we may want to introduce some custom config key to explicitly define a name, such as __name
} else {
- each child node is a config bean instance, named by the config node name (e.g. "first" and "second" for async)
config.asNodeList().ifPresent(it -> it.forEach(configBeanCfg -> {
String name = configBeanCfg.key().name(); // to be used with @Named
String fullyQualifiedKey = configBeanCfg.key().toString(); // can also create a Named instance
}
} else {
// this is a non-repeatable config bean, just create a single instance from this place, not named (e.g. cannot be injected using @Named, as conceptually we cannot give it a name, we may support @default name + no name if we want to
}
To get instaces in Pico:
@Inject //config driven by ServerConfig
Server server;
@Inject //config driven by AsyncConfig
@Named("first")
Async firstAsync;
@Inject
@Named("0") // index based naming - not much usable, but maybe somebody is just interested in the whole list and does not want to inject by name
Bulkhead bulkhead;
The text was updated successfully, but these errors were encountered:
The config driven should work as follows
configuration yaml:
configuration beans:
When processing, the code to create the beans should be similar to this pseudo:
To get instaces in Pico:
The text was updated successfully, but these errors were encountered: