package me.hao0.antares.tower.config; import me.hao0.antares.tower.interceptor.LocaleInterceptor; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; @Configuration public class WebConfig extends WebMvcConfigurerAdapter { @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(localeInterceptor()); } @Bean public LocaleInterceptor localeInterceptor(){ return new LocaleInterceptor(); } }