// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: MIT-0 package aws.proserve.bcs.dr.server; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.annotation.Bean; import org.springframework.web.filter.CommonsRequestLoggingFilter; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; @SpringBootApplication @EnableCaching(proxyTargetClass = true) public class Application { @Bean CommonsRequestLoggingFilter logFilter() { final var filter = new CommonsRequestLoggingFilter(); filter.setIncludePayload(true); filter.setIncludeHeaders(false); filter.setIncludeClientInfo(true); filter.setIncludeQueryString(true); filter.setMaxPayloadLength(64_000); return filter; } @Bean WebMvcConfigurer webMvcConfigurer() { return new WebMvcConfigurerAdapter() { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**") .allowedHeaders("*") .allowedMethods("*") .allowedOrigins("*"); } }; } public static void main(String[] args) { SpringApplication.run(Application.class, args); } }