529f08d3cbb52f998566c4cbdd68e39c79185493
[usecase-ui/intent-analysis.git] /
1 /*
2  * Copyright 2022 Huawei Technologies Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5  * in compliance with the License. You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software distributed under the License
10  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11  * or implied. See the License for the specific language governing permissions and limitations under
12  * the License.
13  */
14
15 package org.onap.usecaseui.intentanalysis.test;
16
17 import java.io.IOException;
18 import javax.servlet.FilterChain;
19 import javax.servlet.ServletException;
20 import javax.servlet.http.HttpServletRequest;
21 import javax.servlet.http.HttpServletResponse;
22 import org.mybatis.spring.annotation.MapperScan;
23 import org.onap.usecaseui.intentanalysis.util.SpringContextUtil;
24 import org.springframework.boot.SpringApplication;
25 import org.springframework.boot.autoconfigure.SpringBootApplication;
26 import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
27 import org.springframework.context.ApplicationContext;
28 import org.springframework.context.annotation.Bean;
29 import org.springframework.scheduling.annotation.EnableScheduling;
30 import org.springframework.web.filter.OncePerRequestFilter;
31
32 @SpringBootApplication(exclude = {SecurityAutoConfiguration.class}, scanBasePackages = "org.onap.usecaseui.intentanalysis")
33 @MapperScan(basePackages = {"org.onap.usecaseui.intentanalysis.mapper"})
34 @EnableScheduling
35
36 public class IntentAnalysisApplicationTests {
37
38     public static void main(String[] args) throws Exception {
39         ApplicationContext applicationContext = SpringApplication.run(IntentAnalysisApplicationTests.class, args);
40         SpringContextUtil.setApplicationContext(applicationContext);
41     }
42
43     @Bean
44     public OncePerRequestFilter accessTokenFilter() {
45         return new OncePerRequestFilter() {
46             @Override
47             protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response,
48                 FilterChain filterChain) throws ServletException, IOException {
49                 filterChain.doFilter(request, response);
50             }
51         };
52     }
53 }