| 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 |
|
| 21220 |
ashik.ali |
11 |
import com.spice.profitmandi.web.interceptor.CreateApiRequestInterceptor;
|
|
|
12 |
import com.spice.profitmandi.web.model.ProfitMandiWebConstants;
|
|
|
13 |
|
| 21165 |
ashik.ali |
14 |
@Configuration
|
|
|
15 |
@EnableWebMvc
|
| 21220 |
ashik.ali |
16 |
@ComponentScan("com.spice.profitmandi.*")
|
| 21165 |
ashik.ali |
17 |
public class WebMVCConfig extends WebMvcConfigurerAdapter{
|
|
|
18 |
|
|
|
19 |
private static final String RESOURCES_PATTERN="/resources/**";
|
|
|
20 |
private static final String RESOURCES_LOCATION="/resources/";
|
|
|
21 |
|
| 21220 |
ashik.ali |
22 |
@Autowired
|
|
|
23 |
CreateApiRequestInterceptor createApiRequestInterceptor;
|
| 21165 |
ashik.ali |
24 |
|
|
|
25 |
@Override
|
|
|
26 |
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
|
|
27 |
registry.addResourceHandler(RESOURCES_PATTERN).addResourceLocations(RESOURCES_LOCATION);
|
|
|
28 |
}
|
|
|
29 |
|
|
|
30 |
@Override
|
|
|
31 |
public void addInterceptors(InterceptorRegistry registry) {
|
| 21220 |
ashik.ali |
32 |
registry.addInterceptor(createApiRequestInterceptor).addPathPatterns(ProfitMandiWebConstants.URL_API);
|
| 21165 |
ashik.ali |
33 |
}
|
| 21220 |
ashik.ali |
34 |
}
|