Alternate of Spring HandlerMethodSelector.selectMethods

半腔热情 提交于 2020-01-25 07:29:11

问题


I was using Spring 4.2.x HandlerMethodSelector class - now migrating to Spring 5.1.x. Can anyone please help? how can we replace the below code in the latest Spring version?

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

回答1:


HandlerMethodSelector replaced with MethodIntrospector

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

You have similar method to use

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

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



来源:https://stackoverflow.com/questions/59305290/alternate-of-spring-handlermethodselector-selectmethods

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!