【发布时间】:2023-01-09 01:08:31
【问题描述】:
我的服务器使用 Spring Security。我的登录控制器中有一段代码,它以德语而不是英语返回错误消息。如何解决?
try{
authentication = authenticationManager.authenticate(
new UsernamePasswordAuthenticationToken(user.getUsername(), user.getPassword())
);
}catch(AuthenticationException e){
response.setErrorMessage(e.getMessage());
return ResponseEntity.status(401).body(response);
}
我知道可以通过本地化解决问题,但我相信一定有更简单的解决方案。
【问题讨论】:
标签: java spring spring-security localization