WebServerFactoryCustomizer set the port, address, error pages etc.

package com.ioc;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory;

/**
 * Created by zhangshukang.
 */

@SpringBootApplication
public class CircularSpringBootApplication implements WebServerFactoryCustomizer<ConfigurableServletWebServerFactory> {



    public static void main(String[] args) {
        SpringApplication.run(CircularSpringBootApplication.class);
    }

    @Override
    public void customize(ConfigurableServletWebServerFactory factory) {
        factory.setPort(9999);
    }
}
原文地址:https://www.cnblogs.com/tonggc1668/p/11751204.html