| 21561 |
ashik.ali |
1 |
package com.spice.profitmandi.web.config;
|
| 21555 |
kshitij.so |
2 |
|
| 21561 |
ashik.ali |
3 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 21555 |
kshitij.so |
4 |
import org.springframework.context.annotation.ComponentScan;
|
|
|
5 |
import org.springframework.context.annotation.Configuration;
|
|
|
6 |
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
| 21561 |
ashik.ali |
7 |
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
| 21555 |
kshitij.so |
8 |
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
|
|
9 |
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
|
|
10 |
|
| 21561 |
ashik.ali |
11 |
import com.spice.profitmandi.web.interceptor.AuthenticationInterceptor;
|
|
|
12 |
|
| 21555 |
kshitij.so |
13 |
@EnableWebMvc
|
|
|
14 |
@Configuration
|
|
|
15 |
@ComponentScan({"com.spice.profitmandi.*"})
|
|
|
16 |
public class WebConfig extends WebMvcConfigurerAdapter{
|
|
|
17 |
|
|
|
18 |
private static final String RESOURCES_PATTERN="/resources/**";
|
|
|
19 |
private static final String RESOURCES_LOCATION="/resources/";
|
|
|
20 |
|
| 21561 |
ashik.ali |
21 |
@Autowired
|
|
|
22 |
AuthenticationInterceptor authenticationInterceptor;
|
| 21555 |
kshitij.so |
23 |
@Override
|
|
|
24 |
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
|
|
25 |
registry.addResourceHandler(RESOURCES_PATTERN).addResourceLocations(RESOURCES_LOCATION);
|
|
|
26 |
}
|
|
|
27 |
|
| 21561 |
ashik.ali |
28 |
@Override
|
|
|
29 |
public void addInterceptors(InterceptorRegistry registry) {
|
| 21598 |
ashik.ali |
30 |
registry.addInterceptor(authenticationInterceptor).addPathPatterns("/**").excludePathPatterns("/login", "/login/");
|
| 21561 |
ashik.ali |
31 |
}
|
|
|
32 |
|
| 21555 |
kshitij.so |
33 |
}
|