@ -200,8 +200,8 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap
* @param handler the bean name of a handler or a handler instance
* @param handler the bean name of a handler or a handler instance
* /
* /
protected void detectHandlerMethods ( final Object handler ) {
protected void detectHandlerMethods ( final Object handler ) {
Class < ? > handlerType = ( handler instanceof String ?
Class < ? > handlerType = ( handler instanceof String beanName ?
obtainApplicationContext ( ) . getType ( ( String ) handler ) : handler . getClass ( ) ) ;
obtainApplicationContext ( ) . getType ( beanName ) : handler . getClass ( ) ) ;
if ( handlerType ! = null ) {
if ( handlerType ! = null ) {
final Class < ? > userType = ClassUtils . getUserClass ( handlerType ) ;
final Class < ? > userType = ClassUtils . getUserClass ( handlerType ) ;
@ -258,8 +258,8 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap
* @return the created HandlerMethod
* @return the created HandlerMethod
* /
* /
protected HandlerMethod createHandlerMethod ( Object handler , Method method ) {
protected HandlerMethod createHandlerMethod ( Object handler , Method method ) {
if ( handler instanceof String ) {
if ( handler instanceof String beanName ) {
return new HandlerMethod ( ( String ) handler ,
return new HandlerMethod ( beanName ,
obtainApplicationContext ( ) . getAutowireCapableBeanFactory ( ) ,
obtainApplicationContext ( ) . getAutowireCapableBeanFactory ( ) ,
obtainApplicationContext ( ) ,
obtainApplicationContext ( ) ,
method ) ;
method ) ;
@ -397,14 +397,13 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap
@Override
@Override
protected boolean hasCorsConfigurationSource ( Object handler ) {
protected boolean hasCorsConfigurationSource ( Object handler ) {
return super . hasCorsConfigurationSource ( handler ) | |
return super . hasCorsConfigurationSource ( handler ) | |
( handler instanceof HandlerMethod & & this . mappingRegistry . getCorsConfiguration ( ( HandlerMethod ) handler ) ! = null ) ;
( handler instanceof HandlerMethod handlerMethod & & this . mappingRegistry . getCorsConfiguration ( handlerMethod ) ! = null ) ;
}
}
@Override
@Override
protected CorsConfiguration getCorsConfiguration ( Object handler , ServerWebExchange exchange ) {
protected CorsConfiguration getCorsConfiguration ( Object handler , ServerWebExchange exchange ) {
CorsConfiguration corsConfig = super . getCorsConfiguration ( handler , exchange ) ;
CorsConfiguration corsConfig = super . getCorsConfiguration ( handler , exchange ) ;
if ( handler instanceof HandlerMethod ) {
if ( handler instanceof HandlerMethod handlerMethod ) {
HandlerMethod handlerMethod = ( HandlerMethod ) handler ;
if ( handlerMethod . equals ( PREFLIGHT_AMBIGUOUS_MATCH ) ) {
if ( handlerMethod . equals ( PREFLIGHT_AMBIGUOUS_MATCH ) ) {
return ALLOW_CORS_CONFIG ;
return ALLOW_CORS_CONFIG ;
}
}