update sliapi-springboot
[ccsdk/sli/core.git] / sliapi / springboot / src / main / java / org / onap / ccsdk / sli / core / sliapi / springboot / core / WebConfig.java
diff --git a/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/core/WebConfig.java b/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/core/WebConfig.java
new file mode 100644 (file)
index 0000000..fb4fe08
--- /dev/null
@@ -0,0 +1,43 @@
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP - CCSDK\r
+ * ================================================================================\r
+ * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.onap.ccsdk.sli.core.sliapi.springboot.core;\r
+\r
+import org.onap.logging.filter.spring.LoggingInterceptor;\r
+import org.springframework.context.annotation.Bean;\r
+import org.springframework.context.annotation.Configuration;\r
+import org.springframework.web.servlet.config.annotation.EnableWebMvc;\r
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;\r
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;\r
+\r
+@EnableWebMvc\r
+@Configuration\r
+public class WebConfig implements WebMvcConfigurer {\r
+\r
+       @Bean\r
+       LoggingInterceptor loggingInterceptor() {\r
+               return new LoggingInterceptor();\r
+       }\r
+\r
+       public void addInterceptors(InterceptorRegistry registry) {     \r
+               registry.addInterceptor(loggingInterceptor()); // handles audit log entries\r
+       }\r
+\r
+}
\ No newline at end of file