title: Registering a Jackson module for Spring Data REST
body: <p>I have a working project based on the Spring Data REST <a href="https://github.com/springsource/spring-data-rest-webmvc">example project</a>, and I'm trying to do custom serialization using a <a href="http://wiki.fasterxml.com/JacksonFeatureModules">Jackson module</a> based on this <a href="https://github.com/SpringSource/spring-data-rest/wiki/Adding-custom-%28de%29serializers-to-Jackson%27s-ObjectMapper">wiki page</a>. </p>
  
  <p>Here's my Jackson module:</p>
  
  <pre><code>public class CustomModule extends SimpleModule {
      public static Logger logger = LoggerFactory.getLogger(CustomModule.class);
  
      public CustomModule() {
          super("CustomModule", new Version(1, 0, 0, null));
      }
  
      @Override
      public void setupModule(SetupContext context) {
          logger.debug("CustomModule.setupModule");
          SimpleSerializers simpleSerializers = new SimpleSerializers();
          simpleSerializers.addSerializer(new CustomDateTimeSerializer());
          context.addSerializers(simpleSerializers);
      }
  
  }
  </code></pre>
  
  <p>The <a href="https://github.com/SpringSource/spring-data-rest/wiki/Adding-custom-%28de%29serializers-to-Jackson%27s-ObjectMapper">wiki page</a> says:</p>
  
  <blockquote>
    <p>Any Module bean declared within the scope of your ApplicationContext will be picked up by the exporter and registered with its ObjectMapper.</p>
  </blockquote>
  
  <p>I'm still pretty new to Spring, so I might just be putting my module bean definition in the wrong place; currently it's in <code>src/main/resources/META-INF/spring-data-rest/shared.xml</code>, which is imported from <code>repositories-export.xml</code>:</p>
  
  <pre><code>&lt;bean id="customModule" class="org.hierax.wpa.schema.mapping.CustomModule" /&gt;
  </code></pre>
  
  <p>I don't see the log statement in <code>setupModule</code>, but I do see log output for other classes in the same package.</p>
  
  <p>I'm using Spring Data REST 1.0.0.RC2.</p>