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.web.server; 018 019import org.springframework.beans.factory.config.BeanPostProcessor; 020 021/** 022 * Strategy interface for customizing {@link WebServerFactory web server factories}. Any 023 * beans of this type will get a callback with the server factory before the server itself 024 * is started, so you can set the port, address, error pages etc. 025 * <p> 026 * Beware: calls to this interface are usually made from a 027 * {@link WebServerFactoryCustomizerBeanPostProcessor} which is a 028 * {@link BeanPostProcessor} (so called very early in the ApplicationContext lifecycle). 029 * It might be safer to lookup dependencies lazily in the enclosing BeanFactory rather 030 * than injecting them with {@code @Autowired}. 031 * 032 * @param <T> the configurable web server factory 033 * @author Phillip Webb 034 * @author Dave Syer 035 * @author Brian Clozel 036 * @since 2.0.0 037 * @see WebServerFactoryCustomizerBeanPostProcessor 038 */ 039@FunctionalInterface 040public interface WebServerFactoryCustomizer<T extends WebServerFactory> { 041 042 /** 043 * Customize the specified {@link WebServerFactory}. 044 * @param factory the web server factory to customize 045 */ 046 void customize(T factory); 047 048}