|
|
|
@ -34,9 +34,13 @@ import java.util.stream.Collectors; |
|
|
|
import javax.servlet.ServletException; |
|
|
|
import javax.servlet.ServletException; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import kotlin.reflect.KFunction; |
|
|
|
|
|
|
|
import kotlin.reflect.jvm.ReflectJvmMapping; |
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.aop.support.AopUtils; |
|
|
|
import org.springframework.aop.support.AopUtils; |
|
|
|
import org.springframework.beans.factory.BeanFactoryUtils; |
|
|
|
import org.springframework.beans.factory.BeanFactoryUtils; |
|
|
|
import org.springframework.beans.factory.InitializingBean; |
|
|
|
import org.springframework.beans.factory.InitializingBean; |
|
|
|
|
|
|
|
import org.springframework.core.KotlinDetector; |
|
|
|
import org.springframework.core.MethodIntrospector; |
|
|
|
import org.springframework.core.MethodIntrospector; |
|
|
|
import org.springframework.lang.Nullable; |
|
|
|
import org.springframework.lang.Nullable; |
|
|
|
import org.springframework.util.Assert; |
|
|
|
import org.springframework.util.Assert; |
|
|
|
@ -585,6 +589,10 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void register(T mapping, Object handler, Method method) { |
|
|
|
public void register(T mapping, Object handler, Method method) { |
|
|
|
|
|
|
|
// Assert that the handler method is not a suspending one.
|
|
|
|
|
|
|
|
if (KotlinDetector.isKotlinType(method.getDeclaringClass()) && KotlinDelegate.isSuspend(method)) { |
|
|
|
|
|
|
|
throw new IllegalStateException("Unsupported suspending handler method detected: " + method); |
|
|
|
|
|
|
|
} |
|
|
|
this.readWriteLock.writeLock().lock(); |
|
|
|
this.readWriteLock.writeLock().lock(); |
|
|
|
try { |
|
|
|
try { |
|
|
|
HandlerMethod handlerMethod = createHandlerMethod(handler, method); |
|
|
|
HandlerMethod handlerMethod = createHandlerMethod(handler, method); |
|
|
|
@ -793,4 +801,15 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Inner class to avoid a hard dependency on Kotlin at runtime. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private static class KotlinDelegate { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static private boolean isSuspend(Method method) { |
|
|
|
|
|
|
|
KFunction<?> function = ReflectJvmMapping.getKotlinFunction(method); |
|
|
|
|
|
|
|
return function != null && function.isSuspend(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|