2016-04-22 18 views
5

Ben Bahar istirahat Servis Çağrı sütun 1 1. satırda dönen hata: Belge

@RestController 
@RequestMapping(value = "/account") 
public class HealthCheckController { 

    protected final Logger log = LoggerFactory.getLogger(this.getClass()); 

    @RequestMapping(value = "/health", method = RequestMethod.GET, produces = { "application/json" }) 
    @ResponseStatus(HttpStatus.OK) 
    @ApiOperation(value = "Returns the health status of the application", notes = "Load balancer user this to confirm the health of the node") 
    public @ResponseBody String getHealth(HttpServletRequest request, HttpServletResponse response) throws Exception { 

     log.info("***" + RequestCorrelation.getId() + "***" + "HealthCheckController - getHealth() Called"); 

     return "{\"health\":{\"SERVICES\":\"OK\"}}"; 
    } 

} 

aradığında ben havalı veya postacı bu açtığınızda sağlık durumu dönecektir hangi REST Çağrısı yazdığı boş bu uygun tepkiyi verir . Ancak bu tarayıcıyı chrome tarayıcısına dokunduğumda

Niçin? ve bunu nasıl düzeltebilirim?

cevap

0

deneyin değil bir dize ancak

return new ResponseEntity<>(yourString, HttpStatus.OK); 

dönmek ve ayrıca bu

public @ResponseBody ResponseEntity<String> getHealth(HttpServletRequest request, HttpServletResponse response) throws Exception { 

bu

public @ResponseBody String getHealth(HttpServletRequest request, HttpServletResponse response) throws Exception { 

değiştirmek Ve işe yaramazsa, eklemeye çalışın. URL'ye tarayıcınızda eriştiğinizde, xml veya .json.

İlgili konular