org.springframework.boot.autoconfigure.web.servlet.WebMvcRegistrations Java Examples

The following examples show how to use org.springframework.boot.autoconfigure.web.servlet.WebMvcRegistrations. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SbpMvcPatchAutoConfiguration.java    From sbp with Apache License 2.0 6 votes vote down vote up
@Bean
@ConditionalOnMissingBean(WebMvcRegistrations.class)
public WebMvcRegistrations mvcRegistrations() {
	return new WebMvcRegistrations() {
		@Override
		public RequestMappingHandlerMapping getRequestMappingHandlerMapping() {
			return new PluginRequestMappingHandlerMapping();
		}

		@Override
		public RequestMappingHandlerAdapter getRequestMappingHandlerAdapter() {
			return null;
		}

		@Override
		public ExceptionHandlerExceptionResolver getExceptionHandlerExceptionResolver() {
			return null;
		}
	};
}
 
Example #2
Source File: WebMvcRegistrationsConfig.java    From yue-library with Apache License 2.0 5 votes vote down vote up
@Override
public RequestMappingHandlerMapping getRequestMappingHandlerMapping() {
	if (!apiVersionProperties.isEnabled()) {
		return WebMvcRegistrations.super.getRequestMappingHandlerMapping();
	}
	
	log.info("【初始化配置-ApiVersionRequestMappingHandlerMapping】默认配置为true,当前环境为true:Restful API接口版本控制,执行初始化 ...");
	return new ApiVersionRequestMappingHandlerMapping(apiVersionProperties);
}
 
Example #3
Source File: VaadinConnectControllerConfiguration.java    From flow with Apache License 2.0 5 votes vote down vote up
/**
 * Registers {@link VaadinConnectController} to use
 * {@link VaadinEndpointProperties#getVaadinEndpointPrefix()} as a prefix
 * for all Vaadin Connect endpoints.
 *
 * @return updated configuration for {@link VaadinConnectController}
 */
@Bean
public WebMvcRegistrations webMvcRegistrationsHandlerMapping() {
    return new WebMvcRegistrations() {

        @Override
        public RequestMappingHandlerMapping getRequestMappingHandlerMapping() {
            return new RequestMappingHandlerMapping() {

                @Override
                protected void registerHandlerMethod(Object handler,
                        Method method, RequestMappingInfo mapping) {
                    // If Spring context initialization fails here with a
                    // stack overflow in a project that also has the
                    // `vaadin-spring` dependency, make sure that the Spring
                    // version in `flow-server` and in `vaadin-spring` is
                    // the same.

                    if (VaadinConnectController.class
                            .equals(method.getDeclaringClass())) {
                        mapping = prependConnectPrefixUrl(mapping);
                    }

                    super.registerHandlerMethod(handler, method, mapping);
                }
            };
        }
    };
}
 
Example #4
Source File: VersionMappingAutoConfiguration.java    From blade-tool with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Bean
public WebMvcRegistrations bladeWebMvcRegistrations() {
	return new BladeWebMvcRegistrations();
}