|
@@ -1,6 +1,9 @@
|
|
|
package space.anyi.serve.config;
|
|
package space.anyi.serve.config;
|
|
|
|
|
|
|
|
|
|
+import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
|
|
|
|
+import org.springframework.context.annotation.Bean;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
|
+import org.springframework.web.filter.CommonsRequestLoggingFilter;
|
|
|
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
|
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
|
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
@@ -16,6 +19,18 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
|
@EnableWebMvc
|
|
@EnableWebMvc
|
|
|
@Configuration
|
|
@Configuration
|
|
|
public class WebConfig implements WebMvcConfigurer {
|
|
public class WebConfig implements WebMvcConfigurer {
|
|
|
|
|
+
|
|
|
|
|
+ @Bean
|
|
|
|
|
+ public CommonsRequestLoggingFilter requestLoggingFilter() {
|
|
|
|
|
+ CommonsRequestLoggingFilter filter = new CommonsRequestLoggingFilter();
|
|
|
|
|
+ filter.setIncludeClientInfo(true);
|
|
|
|
|
+ filter.setIncludeQueryString(true);
|
|
|
|
|
+ filter.setIncludePayload(true);
|
|
|
|
|
+ filter.setIncludeHeaders(true);
|
|
|
|
|
+ filter.setMaxPayloadLength(10000);
|
|
|
|
|
+ return filter;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public void addCorsMappings(CorsRegistry registry) {
|
|
public void addCorsMappings(CorsRegistry registry) {
|
|
|
registry.addMapping("/**") // 允许所有路径
|
|
registry.addMapping("/**") // 允许所有路径
|