在Spring 5和Spring Boot 2中使用WebServerFactoryCustomizer bean代替EmbeddedServletContainerCustomizer时
@Configuration
@EnableWebMvc
@ComponentScan
public class WebConfig implements WebMvcConfigurer {
@Bean
public WebServerFactoryCustomizer<ConfigurableServletWebServerFactory> webServerFactoryCustomizer()
{
return (factory) -> factory.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/not-found"));
}
}
}
然后启动服务,
但是我面临路由问题 当以https://localhost:8080的形式访问网址时 并自动路由到https://ipaddress:8443/login