将这两种方法转换为一种方法的最佳方法是什么?将两种方法合并为一种
@RequestMapping(method = RequestMethod.GET)
public ResponseEntity<String> dbStatus() {
return statusService.isDbAlive() ? RESPONSE_DB_UP : RESPONSE_DB_DOWN;
}
@RequestMapping(method = RequestMethod.GET)
public ResponseEntity<String> appStatus() throws IOException {
return statusService.isAppAlive() ? RESPONSE_APP_UP : RESPONSE_APP_DOWN;
}
我能回到ResponseEntity<String>
的List
?
解释你正在尝试做什么。以上将会在初始化时抛出错误。 'List>'不是默认支持的返回类型,如果您了解'ResponseEntity'是什么,就没有意义。 –
我试图从'StatusService'类中检查数据库和应用程序状态,并返回两者的状态,最好以'ResponseEntity'的形式返回。我只需要一个'@RequestMapping(method = RequestMethod.GET)'而不是两个。 –
invictvs1