当访问不存在的页面时报错:

springboot关闭whitelabel Error page

 

 

 如何关闭它?有2种方法,

方法1:

application.properties中加入server.error.whitelabel.enabled=false

方法2:在MyApplication上边的注解@SpringBootApplication中加入:exclude = ErrorMvcAutoConfiguration.class,即:

@SpringBootApplication(exclude = ErrorMvcAutoConfiguration.class)

 

当访问不存在资源时,

方法1返回:

springboot关闭whitelabel Error page

 

 

方法2返回:

springboot关闭whitelabel Error page

 

相关文章: