@PostConstruct public void config() throws Exception, SecurityException { RequestMappingInfo info = RequestMappingInfo.paths("/test/hh/name").mappingName("mine").build(); mapping.registerMapping(info, new TestMvc(), TestMvc.class.getDeclaredMethod("testA", String.class)); System.out.println("===========xxxxxxxxxxxxxxxxxxxxxxxxxxx=============="); } //
@Override public void onWebApplicationEvent(ContextRefreshedEvent event) { Map<String, Map<String, AutoRequestMethod>> registMethod = autoRequestMethodInvoke.getAutoRequestMethod(); registMethod.forEach((path, methodMap) -> { methodMap.forEach((method, requestMethod) -> { boolean regist = true; for (Entry<RequestMappingInfo, HandlerMethod> entry : requestMappingHandlerMapping.getHandlerMethods() .entrySet()) { RequestMappingInfo mappingInfo = entry.getKey(); if (mappingInfo.getPatternsCondition().getPatterns().contains(path) && mappingInfo.getMethodsCondition().getMethods() .containsAll(Arrays.asList(requestMethod.getRequestMapping().method()))) { regist = false; break; } } if (regist) { requestMappingHandlerMapping.registerMapping(requestMethod.getRequestMappingInfo(), "autoRequestMethodInvoke", requestMethod.getMethod()); } }); }); }
.build(); mapping.registerMapping(sendInfo, controller, sendMethod); mapping.registerMapping(getInfo, controller, getMethod); mapping.registerMapping(verifyInfo, controller, verifyMethod); mapping.registerMapping(noticeInfo, controller, noticeMethod);
RequestMappingInfo mappingInfo = RequestMappingInfo.paths(path).methods(mapping.method()) .build(); requestMappingHandlerMapping.registerMapping(mappingInfo, "autoRequestMethodInvoke", m); cp.setPath(path); cp.setMethod(m);
@PostConstruct public void setup() { requestMappingHandlerMapping .registerMapping(RequestMappingInfo.paths(getContext().getUrlPath() + "/login").build(), loginController(), new Mirror().on(LoginController.class) .reflect().method("getLoginView").withAnyArgs()); }