| 1 |
package com.paymentlink.config; |
| 2 |
|
| 3 |
import org.springframework.context.annotation.Bean; |
| 4 |
import org.springframework.context.annotation.Configuration; |
| 5 |
import org.springframework.scheduling.annotation.EnableScheduling; |
| 6 |
import org.springframework.web.client.RestTemplate; |
| 7 |
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; |
| 8 |
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
| 9 |
|
| 10 |
@Configuration |
| 11 |
@EnableScheduling |
| 12 |
public class WebConfig implements WebMvcConfigurer { |
| 13 |
|
| 14 |
private final LocalizationInterceptor localizationInterceptor; |
| 15 |
|
| 16 |
public WebConfig(LocalizationInterceptor localizationInterceptor) { |
| 17 |
this.localizationInterceptor = localizationInterceptor; |
| 18 |
} |
| 19 |
|
| 20 |
@Override |
| 21 |
public void addInterceptors(InterceptorRegistry registry) { |
| 22 |
registry.addInterceptor(localizationInterceptor) |
| 23 |
.addPathPatterns("/**") |
| 24 |
.excludePathPatterns( |
| 25 |
"/static/**", |
| 26 |
"/css/**", |
| 27 |
"/js/**", |
| 28 |
"/images/**", |
| 29 |
"/favicon.ico", |
| 30 |
"/error" |
| 31 |
); |
| 32 |
} |
| 33 |
|
| 34 |
@Bean |
| 35 |
public RestTemplate restTemplate() { |
| 36 |
return new RestTemplate(); |
| 37 |
} |
| 38 |
} |
| 39 |
|