ErrorPageConfig.java 753 B

1234567891011121314151617181920
  1. package com.izouma.awesomeAdmin.config;
  2. import org.springframework.boot.web.server.ConfigurableWebServerFactory;
  3. import org.springframework.boot.web.server.ErrorPage;
  4. import org.springframework.boot.web.server.WebServerFactoryCustomizer;
  5. import org.springframework.context.annotation.Bean;
  6. import org.springframework.context.annotation.Configuration;
  7. import org.springframework.http.HttpStatus;
  8. @Configuration
  9. public class ErrorPageConfig {
  10. @Bean
  11. public WebServerFactoryCustomizer<ConfigurableWebServerFactory> webServerFactoryCustomizer() {
  12. return (factory -> {
  13. ErrorPage errorPage404 = new ErrorPage(HttpStatus.NOT_FOUND, "/static/admin/index.html");
  14. factory.addErrorPages(errorPage404);
  15. });
  16. }
  17. }