SpringCloud Gateway:同时开启80和443

发布于 2022-08-05  1244 次阅读


@Component
public class PortConfig {
    @Autowired
    private HttpHandler httpHandler;

    private WebServer webServer;

    private Integer httpPort = 80;

    @PostConstruct
    public void start() {
        final val tomcatFactory = new TomcatReactiveWebServerFactory(httpPort);
        WebServer webServer = tomcatFactory.getWebServer(httpHandler);
        webServer.start();
    }

    @PreDestroy
    public void stop() {
        webServer.stop();
    }
}

欢迎欢迎~热烈欢迎~