| Line 2... |
Line 2... |
| 2 |
|
2 |
|
| 3 |
import org.springframework.beans.factory.annotation.Autowired;
|
3 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 4 |
import org.springframework.context.annotation.Bean;
|
4 |
import org.springframework.context.annotation.Bean;
|
| 5 |
import org.springframework.context.annotation.ComponentScan;
|
5 |
import org.springframework.context.annotation.ComponentScan;
|
| 6 |
import org.springframework.context.annotation.Configuration;
|
6 |
import org.springframework.context.annotation.Configuration;
|
| - |
|
7 |
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
| 7 |
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
8 |
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
| 8 |
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
9 |
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
| 9 |
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
10 |
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
| 10 |
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
11 |
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
| 11 |
|
12 |
|
| 12 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
13 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 13 |
import com.spice.profitmandi.web.interceptor.ApiRequestInterceptor;
|
14 |
import com.spice.profitmandi.web.interceptor.ApiRequestInterceptor;
|
| 14 |
import com.spice.profitmandi.web.interceptor.CreateUserRequestInterceptor;
|
15 |
import com.spice.profitmandi.web.interceptor.CreateUserRequestInterceptor;
|
| 15 |
import com.spice.profitmandi.web.interceptor.GoogleLoginRequestInterceptor;
|
16 |
import com.spice.profitmandi.web.interceptor.GoogleLoginRequestInterceptor;
|
| 16 |
import com.spice.profitmandi.web.interceptor.RoleRequestInterceptor;
|
17 |
import com.spice.profitmandi.web.interceptor.RoleRequestInterceptor;
|
| - |
|
18 |
import com.spice.profitmandi.web.interceptor.SimpleCORSInterceptor;
|
| 17 |
|
19 |
|
| 18 |
import springfox.documentation.builders.PathSelectors;
|
20 |
import springfox.documentation.builders.PathSelectors;
|
| 19 |
import springfox.documentation.builders.RequestHandlerSelectors;
|
21 |
import springfox.documentation.builders.RequestHandlerSelectors;
|
| 20 |
import springfox.documentation.service.ApiInfo;
|
22 |
import springfox.documentation.service.ApiInfo;
|
| 21 |
import springfox.documentation.spi.DocumentationType;
|
23 |
import springfox.documentation.spi.DocumentationType;
|
| Line 41... |
Line 43... |
| 41 |
GoogleLoginRequestInterceptor googleLoginRequestInterceptor;
|
43 |
GoogleLoginRequestInterceptor googleLoginRequestInterceptor;
|
| 42 |
|
44 |
|
| 43 |
@Autowired
|
45 |
@Autowired
|
| 44 |
CreateUserRequestInterceptor createUserRequestInterceptor;
|
46 |
CreateUserRequestInterceptor createUserRequestInterceptor;
|
| 45 |
|
47 |
|
| - |
|
48 |
@Autowired
|
| - |
|
49 |
SimpleCORSInterceptor simpleCORSInterceptor;
|
| - |
|
50 |
|
| 46 |
@Bean
|
51 |
@Bean
|
| 47 |
public Docket api() {
|
52 |
public Docket api() {
|
| 48 |
return new Docket(DocumentationType.SWAGGER_2).select()
|
53 |
return new Docket(DocumentationType.SWAGGER_2).select()
|
| 49 |
.apis(RequestHandlerSelectors.any())
|
54 |
.apis(RequestHandlerSelectors.any())
|
| 50 |
.paths(PathSelectors.any()).build()
|
55 |
.paths(PathSelectors.any()).build()
|
| Line 64... |
Line 69... |
| 64 |
public void addInterceptors(InterceptorRegistry registry) {
|
69 |
public void addInterceptors(InterceptorRegistry registry) {
|
| 65 |
registry.addInterceptor(apiRequestInterceptor).addPathPatterns(ProfitMandiConstants.URL_API, ProfitMandiConstants.URL_API + "/");
|
70 |
registry.addInterceptor(apiRequestInterceptor).addPathPatterns(ProfitMandiConstants.URL_API, ProfitMandiConstants.URL_API + "/");
|
| 66 |
registry.addInterceptor(roleRequestInterceptor).addPathPatterns(ProfitMandiConstants.URL_ROLE, ProfitMandiConstants.URL_ROLE + "/");
|
71 |
registry.addInterceptor(roleRequestInterceptor).addPathPatterns(ProfitMandiConstants.URL_ROLE, ProfitMandiConstants.URL_ROLE + "/");
|
| 67 |
registry.addInterceptor(googleLoginRequestInterceptor).addPathPatterns(ProfitMandiConstants.URL_USER_GOOGLE_LOGIN, ProfitMandiConstants.URL_USER_GOOGLE_LOGIN + "/");
|
72 |
registry.addInterceptor(googleLoginRequestInterceptor).addPathPatterns(ProfitMandiConstants.URL_USER_GOOGLE_LOGIN, ProfitMandiConstants.URL_USER_GOOGLE_LOGIN + "/");
|
| 68 |
registry.addInterceptor(createUserRequestInterceptor).addPathPatterns(ProfitMandiConstants.URL_USER, ProfitMandiConstants.URL_USER + "/");
|
73 |
registry.addInterceptor(createUserRequestInterceptor).addPathPatterns(ProfitMandiConstants.URL_USER, ProfitMandiConstants.URL_USER + "/");
|
| - |
|
74 |
registry.addInterceptor(simpleCORSInterceptor).addPathPatterns("/**").excludePathPatterns("/swagger-ui.html");
|
| - |
|
75 |
}
|
| - |
|
76 |
|
| - |
|
77 |
@Override
|
| - |
|
78 |
public void addCorsMappings(CorsRegistry registry) {
|
| - |
|
79 |
registry.addMapping("/**").allowedOrigins("*").allowedMethods("*").
|
| - |
|
80 |
allowedHeaders("*").allowCredentials(false);
|
| 69 |
}
|
81 |
}
|
| 70 |
|
82 |
|
| 71 |
private ApiInfo apiInfo() {
|
83 |
private ApiInfo apiInfo() {
|
| 72 |
@SuppressWarnings("deprecation")
|
84 |
@SuppressWarnings("deprecation")
|
| 73 |
ApiInfo apiInfo = new ApiInfo(
|
85 |
ApiInfo apiInfo = new ApiInfo(
|