Search in sources :

Example 1 with ShenyuHttpRegistryController

use of org.apache.shenyu.admin.controller.ShenyuHttpRegistryController in project incubator-shenyu by apache.

the class ShenyuHttpRegistryControllerBeanPostProcessor method postProcessAfterInitialization.

@Override
public Object postProcessAfterInitialization(final Object bean, final String beanName) throws BeansException {
    if (bean instanceof ShenyuHttpRegistryController) {
        try {
            RequestMappingHandlerMapping requestMappingHandlerMapping = SpringBeanUtils.getInstance().getBean(RequestMappingHandlerMapping.class);
            Method method = requestMappingHandlerMapping.getClass().getSuperclass().getSuperclass().getDeclaredMethod("detectHandlerMethods", Object.class);
            method.setAccessible(true);
            method.invoke(requestMappingHandlerMapping, beanName);
        } catch (Exception e) {
            throw new ShenyuException(e.getMessage());
        }
    }
    return bean;
}
Also used : ShenyuHttpRegistryController(org.apache.shenyu.admin.controller.ShenyuHttpRegistryController) ShenyuException(org.apache.shenyu.common.exception.ShenyuException) RequestMappingHandlerMapping(org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping) Method(java.lang.reflect.Method) ShenyuException(org.apache.shenyu.common.exception.ShenyuException) BeansException(org.springframework.beans.BeansException)

Aggregations

Method (java.lang.reflect.Method)1 ShenyuHttpRegistryController (org.apache.shenyu.admin.controller.ShenyuHttpRegistryController)1 ShenyuException (org.apache.shenyu.common.exception.ShenyuException)1 BeansException (org.springframework.beans.BeansException)1 RequestMappingHandlerMapping (org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping)1