|
@@ -3,11 +3,13 @@ package com.keao.edu.user.config;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
+import com.keao.edu.datasource.interceptor.DataSourceInterceptor;
|
|
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
|
|
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.format.FormatterRegistry;
|
|
import org.springframework.format.FormatterRegistry;
|
|
import org.springframework.http.MediaType;
|
|
import org.springframework.http.MediaType;
|
|
|
|
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
|
|
|
|
import com.keao.edu.common.config.EnumConverterFactory;
|
|
import com.keao.edu.common.config.EnumConverterFactory;
|
|
@@ -23,6 +25,17 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
|
public void addFormatters(FormatterRegistry registry) {
|
|
public void addFormatters(FormatterRegistry registry) {
|
|
registry.addConverterFactory(new EnumConverterFactory());
|
|
registry.addConverterFactory(new EnumConverterFactory());
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void addInterceptors(InterceptorRegistry registry) {
|
|
|
|
+
|
|
|
|
+ registry.addInterceptor(getDataSrouceInterceptor()).addPathPatterns("/**");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Bean
|
|
|
|
+ public DataSourceInterceptor getDataSrouceInterceptor() {
|
|
|
|
+ return new DataSourceInterceptor();
|
|
|
|
+ }
|
|
|
|
|
|
@Bean
|
|
@Bean
|
|
public HttpMessageConverters fastJsonHttpMessageConverters(){
|
|
public HttpMessageConverters fastJsonHttpMessageConverters(){
|