| Line 7... |
Line 7... |
| 7 |
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
7 |
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
| 8 |
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
8 |
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
| 9 |
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
9 |
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
| 10 |
|
10 |
|
| 11 |
import com.spice.profitmandi.web.interceptor.AuthenticationInterceptor;
|
11 |
import com.spice.profitmandi.web.interceptor.AuthenticationInterceptor;
|
| - |
|
12 |
import com.spice.profitmandi.web.interceptor.RoleInterceptor;
|
| 12 |
|
13 |
|
| 13 |
@EnableWebMvc
|
14 |
@EnableWebMvc
|
| 14 |
@Configuration
|
15 |
@Configuration
|
| 15 |
@ComponentScan({"com.spice.profitmandi.*"})
|
16 |
@ComponentScan({"com.spice.profitmandi.*"})
|
| 16 |
public class WebConfig extends WebMvcConfigurerAdapter{
|
17 |
public class WebConfig extends WebMvcConfigurerAdapter{
|
| Line 18... |
Line 19... |
| 18 |
private static final String RESOURCES_PATTERN="/resources/**";
|
19 |
private static final String RESOURCES_PATTERN="/resources/**";
|
| 19 |
private static final String RESOURCES_LOCATION="/resources/";
|
20 |
private static final String RESOURCES_LOCATION="/resources/";
|
| 20 |
|
21 |
|
| 21 |
@Autowired
|
22 |
@Autowired
|
| 22 |
AuthenticationInterceptor authenticationInterceptor;
|
23 |
AuthenticationInterceptor authenticationInterceptor;
|
| - |
|
24 |
|
| - |
|
25 |
@Autowired
|
| - |
|
26 |
RoleInterceptor roleInterceptor;
|
| - |
|
27 |
|
| 23 |
@Override
|
28 |
@Override
|
| 24 |
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
29 |
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
| 25 |
registry.addResourceHandler(RESOURCES_PATTERN).addResourceLocations(RESOURCES_LOCATION);
|
30 |
registry.addResourceHandler(RESOURCES_PATTERN).addResourceLocations(RESOURCES_LOCATION);
|
| 26 |
}
|
31 |
}
|
| 27 |
|
32 |
|
| 28 |
@Override
|
33 |
@Override
|
| 29 |
public void addInterceptors(InterceptorRegistry registry) {
|
34 |
public void addInterceptors(InterceptorRegistry registry) {
|
| 30 |
registry.addInterceptor(authenticationInterceptor).addPathPatterns("/**").excludePathPatterns("/login", "/login/");
|
35 |
registry.addInterceptor(authenticationInterceptor).addPathPatterns("/**").excludePathPatterns("/login", "/login/");
|
| - |
|
36 |
registry.addInterceptor(roleInterceptor);
|
| 31 |
}
|
37 |
}
|
| 32 |
|
38 |
|
| 33 |
}
|
39 |
}
|