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

The following examples show how to use org.springframework.boot.autoconfigure.web.servlet.WebMvcRegistrations. These examples are extracted from open source projects. 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 Project: sbp   Source File: SbpMvcPatchAutoConfiguration.java    License: 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 Project: yue-library   Source File: WebMvcRegistrationsConfig.java    License: 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 Project: flow   Source File: VaadinConnectControllerConfiguration.java    License: 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
@Bean
public WebMvcRegistrations bladeWebMvcRegistrations() {
	return new BladeWebMvcRegistrations();
}