Skip to content

Commit

Permalink
Refactor fillCorsHeader to be non-static for proper dependency injection
Browse files Browse the repository at this point in the history
  • Loading branch information
aditya-baldwa committed Jan 24, 2025
1 parent 8d66ec0 commit 2f6b5c7
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.web.WebProperties;
import org.springframework.boot.autoconfigure.web.reactive.error.AbstractErrorWebExceptionHandler;
import org.springframework.boot.web.reactive.error.ErrorAttributes;
Expand All @@ -38,6 +39,9 @@
@Order(Ordered.HIGHEST_PRECEDENCE)
public class GlobalErrorWebExceptionHandler extends AbstractErrorWebExceptionHandler {

@Autowired
private CorsGlobalConfiguration corsGlobalConfiguration;

public GlobalErrorWebExceptionHandler(ErrorAttributes errorAttributes,
ApplicationContext applicationContext,
ServerCodecConfigurer codecConfigurer) {
Expand Down Expand Up @@ -151,7 +155,7 @@ private String requestId(ServerRequest request) {
}

private Consumer<HttpHeaders> headers(ServerRequest request) {
return CorsGlobalConfiguration::fillCorsHeader;
return corsGlobalConfiguration::fillCorsHeader;
}

private BigDecimal currentTimestamp() {
Expand Down

0 comments on commit 2f6b5c7

Please sign in to comment.