summaryrefslogtreecommitdiffstats
path: root/holmes-actions/src/main/java/org/onap/holmes/common/config/GsonConfig.java
diff options
context:
space:
mode:
Diffstat (limited to 'holmes-actions/src/main/java/org/onap/holmes/common/config/GsonConfig.java')
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/config/GsonConfig.java39
1 files changed, 39 insertions, 0 deletions
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/config/GsonConfig.java b/holmes-actions/src/main/java/org/onap/holmes/common/config/GsonConfig.java
new file mode 100644
index 0000000..58a8f35
--- /dev/null
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/config/GsonConfig.java
@@ -0,0 +1,39 @@
+/**
+ * Copyright 2021 ZTE Corporation.
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.holmes.common.config;
+
+import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.http.converter.json.GsonHttpMessageConverter;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+@Configuration
+public class GsonConfig {
+ @Bean
+ public HttpMessageConverters customConverters() {
+ Collection<HttpMessageConverter<?>> messageConverters = new ArrayList();
+
+ GsonHttpMessageConverter gsonHttpMessageConverter = new GsonHttpMessageConverter();
+ messageConverters.add(gsonHttpMessageConverter);
+
+ return new HttpMessageConverters(true, messageConverters);
+ }
+}