public StaticRequestMappingHandlerMapping getHandlerMapping() { StaticRequestMappingHandlerMapping handlerMapping = new StaticRequestMappingHandlerMapping(); handlerMapping.setEmbeddedValueResolver(new StaticStringValueResolver(placeholderValues)); handlerMapping.setUseSuffixPatternMatch(useSuffixPatternMatch); handlerMapping.setUseTrailingSlashMatch(useTrailingSlashPatternMatch); handlerMapping.setOrder(0); handlerMapping.setInterceptors(getInterceptors()); if (removeSemicolonContent != null) { handlerMapping.setRemoveSemicolonContent(removeSemicolonContent); } return handlerMapping; }
private void registerMvcSingletons(StubWebApplicationContext wac) { StandaloneConfiguration config = new StandaloneConfiguration(); config.setApplicationContext(wac); wac.addBeans(this.controllerAdvice); StaticRequestMappingHandlerMapping hm = config.getHandlerMapping(); hm.setServletContext(wac.getServletContext()); hm.setApplicationContext(wac); hm.afterPropertiesSet(); hm.registerHandlers(this.controllers); wac.addBean("requestMappingHandlerMapping", hm); RequestMappingHandlerAdapter handlerAdapter = config.requestMappingHandlerAdapter(); handlerAdapter.setServletContext(wac.getServletContext()); handlerAdapter.setApplicationContext(wac); handlerAdapter.afterPropertiesSet(); wac.addBean("requestMappingHandlerAdapter", handlerAdapter); wac.addBean("handlerExceptionResolver", config.handlerExceptionResolver()); wac.addBeans(initViewResolvers(wac)); wac.addBean(DispatcherServlet.LOCALE_RESOLVER_BEAN_NAME, this.localeResolver); wac.addBean(DispatcherServlet.THEME_RESOLVER_BEAN_NAME, new FixedThemeResolver()); wac.addBean(DispatcherServlet.REQUEST_TO_VIEW_NAME_TRANSLATOR_BEAN_NAME, new DefaultRequestToViewNameTranslator()); this.flashMapManager = new SessionFlashMapManager(); wac.addBean(DispatcherServlet.FLASH_MAP_MANAGER_BEAN_NAME, this.flashMapManager); }
public void registerHandlers(Object...handlers) { for (Object handler : handlers) { detectHandlerMethods(handler); } } }