-
Notifications
You must be signed in to change notification settings - Fork 566
API Changes in 1.0
Config API was refactored and there are a lot of changes. The main differences:
- Method
Config.value()
is gone, please useConfig.asString()
instead (returnsConfigValue
that has all the methods ofOptional<String>
, and it also has a methodConfigValue.asOptional()
if actualOptional
instance is required) - Methods directly accessing a typed value that threw MissingValueException are gone as they promoted usage that lead to unexpected problems in runtime. Config is by nature optional - each node may or may not be present. The new API is returning
ConfigValue
that is in fact an Optional with a few additional methods. If original behavior is needed (e.g. in case a missing configuration node should really fail the program), the methodConfigValue.get()
has the same semantics as the original methods. - All typed methods except for a few shortcuts (asString, asInt etc.) are gone - the (correctly typed) equal methods can be found on
ConfigValue
- config node with default, supplier of config node, optional value, supplier of optional etc. - Config now supports generics - you can use
GenericType
to convert a config node, as long as appropriate converter is configured with config. - Support for object mapping that searched for static methods, constructors etc. when using method
Config.as(Class)
is now in a separate modulehelidon-config-object-mapping
, as it violated our "No Magic" principle for helidon SE. You can use custom mappers as before, or use the magic by adding the new module to your dependencies. In addition there is a methodConfig.as(Function<Config, T>)
that can be used with similar semantics for cases that have a static method/constructor with a singleConfig
parameter.
Examples:
// original
config.value().ifPresent(this::setValue);
// new
config.asString().ifPresent(this::setValue);
// original
String failIfMissing = config.asString();
// new
String failIfMissing = config.asString().get();
// original
String withDefault = config.asString("defaultValue");
// new
String withDefault = config.asString().orElse("defaultValue");
// original
Supplier<Optional<String>> sup = config.asOptionalStringSupplier();
Supplier<Optional<Integer>> sup2 = config.asOptionalIntSupplier();
// new
Supplier<Optional<String>> sup = config.asString().optionalSupplier();
Supplier<Optional<Integer>> sup2 = config.asInt().optionalSupplier();
// original
config.as(FooBar.class).ifPresent(Foo::bar); // FooBar has static factory method create(Config)
// new
config.as(FooBar::create).ifPresent(Foo::bar);
The tracing module (helidon-webserver-zipkin
) is removed.
See description in https://github.com/oracle/helidon/blob/master/tracing/README.md
- tracer is abstracted through a TracerBuilder API and TracerProvider SPI
- integration is separated into modules
- integration with Zipkin tracer -
helidon-tracing-zipkin
- can be used standalone (to have a hard dependency on zipkin in sources) or withhelidon-tracing
to abstract the implementation away - integration with webserver - the
helidon-tracing
module is used to abstract the tracer + manual registration with webserver - integration with Jersey client -
helidon-tracing-jersey-client
- integration with Jersey server -
helidon-tracing-jersey
- integration with Helidon MP -
helidon-microprofile-tracing
- integration with Zipkin tracer -
Bundles are moved to a bundles module and have a new group id and artifact id.
GroupId: io.helidon.bundles
ArtifactId: helidon-bundles-${component}
- e.g. helidon-bundles-config
Old bundles are removed from the project.
Google login provider and Expression Language Policy ABAC support were removed, as they introduce too many dependencies. Please if you need these, add them separately.
Static factory methods that create a new instance were mostly renamed to create
, including the ones that accept config as a parameter.
Example: ServerConfiguration.create()
API methods do not use the verb set
and get
. Some methods were renamed to have a consistent approach across all modules.
Old approach: void setPort(int)
and int getPort()
New approach: void port(int)
and int port()