java - Spring HandlerMethodSelector.selectMethods 的替代品
问题描述
我使用的是 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 自 Spring 4.2.3 起,支持广义和精炼的 {@link MethodIntrospector}
你有类似的方法可以使用
static Set<Method> selectMethods(Class<?> targetType, ReflectionUtils.MethodFilter methodFilter)
根据过滤器选择给定目标类型的方法。
推荐阅读
- node.js - 节点:进程终止后持久化数据
- rust - 在此范围内找不到类型“F”
- firebase - 颤动中的Firebase集合关系
- javascript - 使用官方cli生成项目时,tailwind样式不适用于下一个js
- c++ - 只是一串字母,没有任何特殊字符
- javascript - 将 Promise 转换为异步
- reactjs - 如何在我的 react/django 网站上显示来自 blob 存储的图像
- authentication - GSM移动网络中Ki唯一性的原因
- javascript - 在弹出窗口中显示可编辑的可编辑表单
- azure - 存储帐户中的 Terraform 状态文件