a5cce460741371d298d1bfbafcebe47033fcea6e
[sdc/sdc-workflow-designer.git] /
1 /*
2  * Copyright © 2018 European Support Limited
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  * ============LICENSE_END=========================================================
16  * Modifications copyright (c) 2019 Nokia
17  * ================================================================================
18  */
19
20 package org.onap.sdc.workflow.server.config;
21
22 import java.util.List;
23 import org.onap.sdc.workflow.server.resolvers.UserIdResolver;
24 import org.openecomp.sdc.logging.servlet.spring.LoggingInterceptor;
25 import org.springframework.beans.factory.annotation.Autowired;
26 import org.springframework.context.annotation.Configuration;
27 import org.springframework.web.method.support.HandlerMethodArgumentResolver;
28 import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
29 import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
30
31 @Configuration
32 public class ApplicationConfigurer implements WebMvcConfigurer {
33
34     private final LoggingInterceptor loggingInterceptor;
35
36     @Autowired
37     public ApplicationConfigurer(LoggingInterceptor loggingInterceptor) {
38         this.loggingInterceptor = loggingInterceptor;
39     }
40
41     @Override
42     public void addInterceptors(InterceptorRegistry registry) {
43         registry.addInterceptor(loggingInterceptor);
44     }
45
46     @Override
47     public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
48         argumentResolvers.add(new UserIdResolver());
49     }
50 }