Package org.sdase.commons.server.jackson
Class JacksonConfigurationBundle
java.lang.Object
org.sdase.commons.server.jackson.JacksonConfigurationBundle
- All Implemented Interfaces:
io.dropwizard.core.ConfiguredBundle<io.dropwizard.core.Configuration>
public class JacksonConfigurationBundle
extends Object
implements io.dropwizard.core.ConfiguredBundle<io.dropwizard.core.Configuration>
Configures the
ObjectMapper
to support HAL structures using Resource
, Link
and EmbeddedResource
and field filtering on client
request for resources annotated by EnableFieldFilter
.
The module registers itself when created in the run method
of the application:
public void run(SolutionServiceConfiguration configuration, Environment environment) {
// ...
JacksonConfigurationBundle.builder(environment).build();
// ...
}
If Jacksons yaml provider is available in the classpath it will be registered as well so that
the application is able to respond to "Accept application/yaml" requests. The JacksonYAMLProvider
is available with
com.fasterxml.jackson.jaxrs:jackson-jaxrs-yaml-provider:[jacksonVersion]
. The class will be
loaded dynamically to avoid a forced runtime dependency.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuilder()
void
initialize
(io.dropwizard.core.setup.Bootstrap<?> bootstrap) Initializes theObjectMapper
as in the defaultBootstrap
but does not add theFuzzyEnumModule
as it breaks enum features of Jackson.void
run
(io.dropwizard.core.Configuration configuration, io.dropwizard.core.setup.Environment environment)
-
Method Details
-
builder
-
initialize
public void initialize(io.dropwizard.core.setup.Bootstrap<?> bootstrap) Initializes theObjectMapper
as in the defaultBootstrap
but does not add theFuzzyEnumModule
as it breaks enum features of Jackson.- Specified by:
initialize
in interfaceio.dropwizard.core.ConfiguredBundle<io.dropwizard.core.Configuration>
-
run
public void run(io.dropwizard.core.Configuration configuration, io.dropwizard.core.setup.Environment environment) - Specified by:
run
in interfaceio.dropwizard.core.ConfiguredBundle<io.dropwizard.core.Configuration>
-