Make the jax-rs resource a spring boot RestController
[aai/traversal.git] / aai-traversal / src / main / java / org / onap / aai / web / WebConfiguration.java
index a2a4271..2dee807 100644 (file)
  */
 package org.onap.aai.web;
 
-import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.http.MediaType;
+import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
 import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 
 @Configuration
-public class WebConfiguration {
+public class WebConfiguration implements WebMvcConfigurer {
 
-    @Bean
-    public WebMvcConfigurerAdapter forwardToIndex() {
-        return new WebMvcConfigurerAdapter() {
-            @Override
-            public void addViewControllers(ViewControllerRegistry registry) {
-                registry.addViewController("/swagger").setViewName("redirect:/swagger/index.html");
-                registry.addViewController("/swagger/").setViewName("redirect:/swagger/index.html");
-                registry.addViewController("/docs").setViewName("redirect:/docs/html/index.html");
-                registry.addViewController("/docs/").setViewName("redirect:/docs/html/index.html");
-            }
-        };
+    @Override
+    public void addViewControllers(ViewControllerRegistry registry) {
+        registry.addViewController("/swagger").setViewName("redirect:/swagger/index.html");
+        registry.addViewController("/swagger/").setViewName("redirect:/swagger/index.html");
+        registry.addViewController("/docs").setViewName("redirect:/docs/html/index.html");
+        registry.addViewController("/docs/").setViewName("redirect:/docs/html/index.html");
+    }
+
+    @Override
+    public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
+        configurer.defaultContentType(MediaType.APPLICATION_JSON);
     }
 }