0
我在那里,我从我的控制器使用ResponseEntity
春季动态的HTTPStatus从变量
return new ResponseEntity<String>("Unrecognised request.", HttpStatus.BAD_REQUEST);
返回动态的HTTPStatus代码的应用程序的下一个要求是响应身体和状态代码将被从数据库加载。代码将看起来像
String msg = <<loaded from database>>;
String status = <<loaded from database>>; //type can be changed to int
return new ResponseEntity<String>(msg, <..what to do here ??..>);
不是状态代码将从数据库作为字符串/整数retrived。而作为HttpStatus是一个枚举,我没有找到任何其他方式来做到这一点。
有没有解决我的需求?