-
Notifications
You must be signed in to change notification settings - Fork 564
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);
// original
config.as(Parsable.class).ifPresent(this::parsable); // Parsable has static factory method parse(String)
// new
config.asString().as(Parsable::parse).ifPresent(this::parsable);
-
Removal of
helidon-webserver-netty
moduleThe module
io.helidon.webserver:helidon-webserver-netty
has been combined intoio.helidon.webserver:helidon-webserver
. Projects no longer need to declare 2 dependencies for the WebServer, a single dependency onio.helidon.webserver:helidon-webserver
is sufficient. -
JsonSupport has moved to a top level module. This has resulted in a change to the Maven coordinates and Java package for JsonSupport.
New Java package:
io.helidon.media.jsonp.server.JsonSupport
New coordinates:<groupId>io.helidon.media.jsonp</groupId> <artifactId>helidon-media-jsonp-server</artifactId>
-
JsonSupport.get()
nowJsonSupport.create()
As part of aligning factory methods the
get()
method onJsonSupport
has been renamedcreate()
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()
- ABAC modules renamed according to directory structure (groupId is
io.helidon.security.abac
, artifactIds remain the same) - Integrations have a different group id (
io.helidon.security.integration
), artifactIds remain the same - Security providers:
- modules renamed according to directory structure (group id is
io.helidon.security.providers
- artifactIds modified to have plural of providers (used to be
helidon-security-provider-abac
, nowhelidon-security-providers-abac
) - package is now
io.helidon.security.providers.${module-name}
- jigsaw (java9/jpms) module name is now
io.helidon.security.providers.${module-name}
- Google login button support is now
io.helidon.security.providers.google.login
(to align with module name and aritfact id) - HTTP Signatures, HTTP Basic/Digest - artifact id, directory and java module renamed to be aligned
- modules renamed according to directory structure (group id is
- Secured config moved to config module (as it has no dependencies outside of common). New coordinates:
io.helidon.config:helidon-config-secure
, packageio.helidon.config.secure
- Integration modules (WebServer and Jersey) now have
integration
package to align with directory structure, module names (jigsaw) changed - instead ofadapter
now usesintegration
- Security annotations moved to root of security, package renamed to
io.helidon.security.annotations
to align with directory structure.
Prometheus support and helidon-metrics-se are moved to a root level module metrics
, including group ids, artifact ids and packages.
Metrics module: io.helidon.metrics:helidon-metrics
Prometheus module: io.helidon.metrics:helidon-metrics-prometheus
Microprofile implementation is now formed by a single module: io.helidon.microprofile.metrics:helidon-microprofile-metrics
Module with built-in health checks was moved to io.helidon.health:helidon-health-checks
. This may have been used to exclude built-ins when using Helidon MicroProfile 1.2.
There is a new module io.helidon.health:helidon-health
with support for health checks in helidon SE. See examples/health/basics for an example on how to use these.
Microprofile jigsaw modules now use microprofile
instead of mp
in module name.