001/*
002 * Copyright 2012-2018 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.boot.autoconfigure.web.servlet;
018
019import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
020import org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver;
021import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;
022import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
023
024/**
025 * Interface to register key components of the {@link WebMvcConfigurationSupport} in place
026 * of the default ones provided by Spring MVC.
027 * <p>
028 * All custom instances are later processed by Boot and Spring MVC configurations. A
029 * single instance of this component should be registered, otherwise making it impossible
030 * to choose from redundant MVC components.
031 *
032 * @author Brian Clozel
033 * @since 2.0.0
034 * @see org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration.EnableWebMvcConfiguration
035 */
036public interface WebMvcRegistrations {
037
038        /**
039         * Return the custom {@link RequestMappingHandlerMapping} that should be used and
040         * processed by the MVC configuration.
041         * @return the custom {@link RequestMappingHandlerMapping} instance
042         */
043        default RequestMappingHandlerMapping getRequestMappingHandlerMapping() {
044                return null;
045        }
046
047        /**
048         * Return the custom {@link RequestMappingHandlerAdapter} that should be used and
049         * processed by the MVC configuration.
050         * @return the custom {@link RequestMappingHandlerAdapter} instance
051         */
052        default RequestMappingHandlerAdapter getRequestMappingHandlerAdapter() {
053                return null;
054        }
055
056        /**
057         * Return the custom {@link ExceptionHandlerExceptionResolver} that should be used and
058         * processed by the MVC configuration.
059         * @return the custom {@link ExceptionHandlerExceptionResolver} instance
060         */
061        default ExceptionHandlerExceptionResolver getExceptionHandlerExceptionResolver() {
062                return null;
063        }
064
065}