I try to migrate my app from spring boot 1.5 to 2.0 The problem is that I cannot find EmbeddedServletContainerCustomizer. Any ideas how to make it through?
@Bean
public EmbeddedServletContainerCustomizer customizer() {
return container -> container.addErrorPages(new ErrorPage(HttpStatus.UNAUTHORIZED, "/unauthenticated"));
}
Update: I found it as ServletWebServerFactoryCustomizer in org.springframework.boot.autoconfigure.web.servlet package.
@Bean
public ServletWebServerFactoryCustomizer customizer() {
return container -> container.addErrorPages(new ErrorPage(HttpStatus.UNAUTHORIZED, "/unauthenticated"));
}
But there is an error: Cannot resolve method
'addErrorPages(org.springframework.boot.web.server.ErrorPage)'
I also had to change import of new Error Page from org.springframework.boot.web.servlet
to org.springframework.boot.web.server