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.

  • Method Details

    • builder

      public static JacksonConfigurationBundle.Builder builder()
    • initialize

      public void initialize(io.dropwizard.core.setup.Bootstrap<?> bootstrap)
      Initializes the ObjectMapper as in the default Bootstrap but does not add the FuzzyEnumModule as it breaks enum features of Jackson.

      Specified by:
      initialize in interface io.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 interface io.dropwizard.core.ConfiguredBundle<io.dropwizard.core.Configuration>