Reputation: 24679
My question relates to Spring Boot and how to configure error pages in a production web app running in cloudfoundry.
In the Spring IO Sagan reference application, I noticed in the MvcConfig, the following code:
@Configuration
public static class ErrorConfig implements EmbeddedServletContainerCustomizer {
@Override
public void customize(ConfigurableEmbeddedServletContainer factory) {
factory.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/404"));
factory.addErrorPages(new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/500"));
}
}
Is this configuration used in the cloud too? If so why is it named: EmbeddedServletContainerCustomizer
? If not what is the equivalent for the cloud?
Upvotes: 1
Views: 1522
Reputation: 116111
Yes, you can use EmbeddedServletContainerCustomizer
when deploying to the cloud. Sagan itself is doing exactly that on CloudFoundry for the spring.io website.
The "embedded" in the name of EmbeddedServletContainerCustomizer
refers to the fact that the servlet container is embedded in your application's executable jar file. It's the recommended approach for cloud deployment.
Upvotes: 2