Spring JPA: jackson custom serializing
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Tue, 26 Jul 2016 20:19:40 +0000 (22:19 +0200)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Tue, 26 Jul 2016 20:19:40 +0000 (22:19 +0200)
SpringJava/JPA/spring-jpa-resources/src/main/java/de/spring/example/rest/resource/modules/SpringJpaModule.java [new file with mode: 0644]
SpringJava/JPA/spring-jpa-resources/src/main/resources/spring-configuration/mvc/rest/rest-config.xml

diff --git a/SpringJava/JPA/spring-jpa-resources/src/main/java/de/spring/example/rest/resource/modules/SpringJpaModule.java b/SpringJava/JPA/spring-jpa-resources/src/main/java/de/spring/example/rest/resource/modules/SpringJpaModule.java
new file mode 100644 (file)
index 0000000..ad5f38d
--- /dev/null
@@ -0,0 +1,11 @@
+package de.spring.example.rest.resource.modules;
+
+import com.fasterxml.jackson.databind.module.SimpleModule;
+
+public class SpringJpaModule extends SimpleModule {
+
+       @Override
+       public void setupModule(final SetupContext context) {
+               
+       }
+}
index e8cc1a8..f78c1d2 100644 (file)
@@ -58,6 +58,7 @@
                 <util:constant static-field="com.fasterxml.jackson.databind.MapperFeature.DEFAULT_VIEW_INCLUSION"/>
             </array>
         </property>
+        <property name="modulesToInstall" ref="customJacksonModules"/>
     </bean>
     
     <util:list id="messageConverters">
     
        <bean id="handlerMapping" class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping"/>
 
+
+       <util:list id="customJacksonModules">
+               <array>
+                       <value type="java.lang.Class">de.spring.example.rest.resource.modules.SpringJpaModule</value>
+               </array>                
+       </util:list>
+       
        <mvc:default-servlet-handler />
        
 </beans>