Polish CorsConfigurationSource Selection Logic

Issue gh-16501
This commit is contained in:
Josh Cummings 2025-03-26 13:44:47 -06:00
parent 1618963255
commit e65e32bb42
No known key found for this signature in database
GPG Key ID: 869B37A20E876129

View File

@ -107,7 +107,7 @@ public class CorsConfigurer<H extends HttpSecurityBuilder<H>> extends AbstractHt
* @return
*/
private static CorsFilter getMvcCorsFilter(ApplicationContext context) {
if (context.getBeanNamesForType(CorsConfigurationSource.class).length > 0) {
if (context.containsBean(HANDLER_MAPPING_INTROSPECTOR_BEAN_NAME)) {
CorsConfigurationSource corsConfigurationSource = context
.getBean(HANDLER_MAPPING_INTROSPECTOR_BEAN_NAME, CorsConfigurationSource.class);
return new CorsFilter(corsConfigurationSource);