Spring异常引发消息-无消息

时间:2020-09-10 16:45:19

标签: java spring rest web exception

我需要在spring服务器中显示某些异常的消息

当我在服务器内部引发异常时,我收到了500状态错误消息,并显示消息“没有可用消息”

我使用WebSecurityConfigurerAdapter覆盖了一些安全阶段

@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter{
   @Override
   protected void configure(HttpSecurity http) throws Exception{
      http.httpBasic().disable();
      http.cors().and().csrf().disable().authorizeRequests(); }

我知道我可以将异常处理添加到HttpSecurity中,但是我不知道如何使它向客户端显示异常消息

0 个答案:

没有答案