【发布时间】:2020-02-18 09:17:43
【问题描述】:
当在生产中我想禁用 /actuator 端点但仍然允许 /actuator/health。我已经使用 SecurityConfigurerAdapter 尝试了下面的代码,但它返回 500。我想返回 404 并获得“找不到页面”错误页面。非常感谢任何帮助
@Override
protected void configure(HttpSecurity http) throws Exception {
super.configure(http);
if(isProd) {
http.authorizeRequests().antMatchers("/actuator/", "/actuator").denyAll();
}
}
【问题讨论】:
标签: java spring spring-boot spring-security spring-boot-actuator