package com.mangofactory.swagger.configuration;

import com.fasterxml.jackson.module.scala.DefaultScalaModule;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;

import javax.annotation.PostConstruct;
import java.util.List;

@Component
@SuppressWarnings({"SpringJavaAutowiringInspection"})
public class JacksonScalaSupport {
   private RequestMappingHandlerAdapter requestMappingHandlerAdapter;

   @PostConstruct
   public void init() {
      List<HttpMessageConverter<?>> messageConverters = requestMappingHandlerAdapter.getMessageConverters();
      for (HttpMessageConverter<?> messageConverter : messageConverters) {
         if (messageConverter instanceof MappingJackson2HttpMessageConverter) {
            MappingJackson2HttpMessageConverter m = (MappingJackson2HttpMessageConverter) messageConverter;
            m.getObjectMapper().registerModule(new DefaultScalaModule());
         }
      }
   }

   @Autowired
   public void setRequestMappingHandlerAdapter(RequestMappingHandlerAdapter requestMappingHandlerAdapter) {
      this.requestMappingHandlerAdapter = requestMappingHandlerAdapter;
   }
}
@@ -319,57 +319,8 @@
 er;%0A
-import org.springframework.stereotype.Component;%0A
 impo
@@ -474,19 +474,8 @@
 t;%0A%0A
-@Component%0A
 @Sup
@@ -558,16 +558,65 @@
 upport %7B
+%0A%0A   private Boolean registerScalaModule = false;
 %0A   priv
@@ -717,24 +717,60 @@
 id init() %7B%0A
+      if (registerScalaModule) %7B%0A   
       List%3CH
@@ -872,16 +872,19 @@
 ;%0A      
+   
 for (Htt
@@ -949,24 +949,27 @@
  %7B%0A         
+ 
+  
 if (messageC
@@ -1039,16 +1039,19 @@
         
+  
+ 
 MappingJ
@@ -1150,16 +1150,19 @@
         
+   
 m.getObj
@@ -1215,16 +1215,30 @@
 ule());%0A
+            %7D%0A
         
@@ -1452,10 +1452,224 @@
 er;%0A   %7D
+%0A%0A   public Boolean getRegisterScalaModule() %7B%0A      return registerScalaModule;%0A   %7D%0A%0A   public void setRegisterScalaModule(Boolean registerScalaModule) %7B%0A      this.registerScalaModule = registerScalaModule;%0A   %7D
 %0A%7D

Remove @Component - client spring config should configure this bean if its required