in my project , I hava a PlatformRequestMappingHandlerMapping。


public class PlatformRequestMappingHandlerMapping extends RequestMappingHandlerMapping {

    @Override
    protected RequestMappingInfo getMappingForMethod(Method method, Class<?> handlerType) {
        RequestMappingInfo requestMappingInfo = super.getMappingForMethod(method, handlerType);
        if (requestMappingInfo != null)
            return requestMappingInfo;
        return createCustomRequestMappingInfo(method);
    }

    private RequestMappingInfo createCustomRequestMappingInfo(AnnotatedElement element) {
        PlatformRestMapping mapping = AnnotatedElementUtils.findMergedAnnotation(element, PlatformRestMapping.class);
        // ....
        return RequestMappingInfo.paths(URI_PREFIX_OF_API + mapping.value())
                .methods(methods)
                .options(getConfig()) // need use super.config
                .build();
    }

    // bad impl
    private RequestMappingInfo.BuilderConfiguration getConfig() {
        try {
            Object config = FieldUtils.readField(this, "config", true);
            return (RequestMappingInfo.BuilderConfiguration) config;
        } catch (IllegalAccessException e) {
            throw new RuntimeException("config");
        }

    }
}


Comment From: sbrannen

A new public RequestMappingInfo.BuilderConfiguration getBuilderConfiguration() method was introduced in RequestMappingHandlerMapping in 5.3.14.

I am therefore closing this as a duplicate of #27723.