Update actuator support to ensure CORS properties always apply

Update `AbstractWebFluxEndpointHandlerMapping` and
`AbstractWebMvcEndpointHandlerMapping` to ensure cors
configuration is applied.

See gh-45487
This commit is contained in:
Phillip Webb
2025-05-08 14:56:59 -07:00
parent 1f53f1db99
commit c15418b693
2 changed files with 14 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -218,6 +218,12 @@ public abstract class AbstractWebFluxEndpointHandlerMapping extends RequestMappi
return this.corsConfiguration;
}
@Override
protected CorsConfiguration getCorsConfiguration(Object handler, ServerWebExchange exchange) {
CorsConfiguration corsConfiguration = super.getCorsConfiguration(handler, exchange);
return (corsConfiguration != null) ? corsConfiguration : this.corsConfiguration;
}
@Override
protected boolean isHandler(Class<?> beanType) {
return false;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -233,6 +233,12 @@ public abstract class AbstractWebMvcEndpointHandlerMapping extends RequestMappin
return this.corsConfiguration;
}
@Override
protected CorsConfiguration getCorsConfiguration(Object handler, HttpServletRequest request) {
CorsConfiguration corsConfiguration = super.getCorsConfiguration(handler, request);
return (corsConfiguration != null) ? corsConfiguration : this.corsConfiguration;
}
@Override
protected boolean isHandler(Class<?> beanType) {
return false;