gpt4 book ai didi

java - Spring HandlerMethodSelector.selectMethods 的替代品

转载 作者:行者123 更新时间:2023-12-02 09:12:22 25 4
gpt4 key购买 nike

我使用的是 Spring 4.2.x HandlerMethodSelector 类 - 现在迁移到 Spring 5.1.x。有人可以帮忙吗?我们如何在最新的 Spring 版本中替换以下代码?

final Set<Method> methods = HandlerMethodSelector.selectMethods(userType, new MethodFilter()
{
@Override
public boolean matches(final Method method)
{
return hasRequestMappingOverrideAnnotation(method);
}
});

最佳答案

HandlerMethodSelector替换为 MethodIntrospector

@deprecated as of Spring 4.2.3, in favor of the generalized and refined {@link MethodIntrospector}

您有类似的方法可以使用

 static Set<Method> selectMethods(Class<?> targetType, ReflectionUtils.MethodFilter methodFilter)

Select methods on the given target type based on a filter.

关于java - Spring HandlerMethodSelector.selectMethods 的替代品,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59305290/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com