| 21165 |
ashik.ali |
1 |
package com.spice.profitmandi.web.config;
|
|
|
2 |
|
| 21220 |
ashik.ali |
3 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 21165 |
ashik.ali |
4 |
import org.springframework.context.annotation.ComponentScan;
|
|
|
5 |
import org.springframework.context.annotation.Configuration;
|
|
|
6 |
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
|
|
7 |
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
|
|
8 |
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
|
|
9 |
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
|
|
10 |
|
| 21236 |
ashik.ali |
11 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
|
|
12 |
import com.spice.profitmandi.web.interceptor.ApiRequestInterceptor;
|
|
|
13 |
import com.spice.profitmandi.web.interceptor.RoleRequestInterceptor;
|
| 21220 |
ashik.ali |
14 |
|
| 21165 |
ashik.ali |
15 |
@Configuration
|
|
|
16 |
@EnableWebMvc
|
| 21220 |
ashik.ali |
17 |
@ComponentScan("com.spice.profitmandi.*")
|
| 21165 |
ashik.ali |
18 |
public class WebMVCConfig extends WebMvcConfigurerAdapter{
|
|
|
19 |
|
|
|
20 |
private static final String RESOURCES_PATTERN="/resources/**";
|
|
|
21 |
private static final String RESOURCES_LOCATION="/resources/";
|
|
|
22 |
|
| 21220 |
ashik.ali |
23 |
@Autowired
|
| 21236 |
ashik.ali |
24 |
ApiRequestInterceptor apiRequestInterceptor;
|
| 21165 |
ashik.ali |
25 |
|
| 21236 |
ashik.ali |
26 |
@Autowired
|
|
|
27 |
RoleRequestInterceptor roleRequestInterceptor;
|
|
|
28 |
|
| 21165 |
ashik.ali |
29 |
@Override
|
|
|
30 |
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
|
|
31 |
registry.addResourceHandler(RESOURCES_PATTERN).addResourceLocations(RESOURCES_LOCATION);
|
|
|
32 |
}
|
|
|
33 |
|
|
|
34 |
@Override
|
|
|
35 |
public void addInterceptors(InterceptorRegistry registry) {
|
| 21236 |
ashik.ali |
36 |
registry.addInterceptor(apiRequestInterceptor).addPathPatterns(ProfitMandiConstants.URL_API, ProfitMandiConstants.URL_API + "/");
|
|
|
37 |
registry.addInterceptor(roleRequestInterceptor).addPathPatterns(ProfitMandiConstants.URL_ROLE, ProfitMandiConstants.URL_ROLE + "/");
|
| 21165 |
ashik.ali |
38 |
}
|
| 21220 |
ashik.ali |
39 |
}
|