Use @RequestParam
@RequestMapping(method = RequestMethod.GET) public @ResponseBody item getitem(@RequestParam("data") String itemid){ item i = itemDao.findOne(itemid); String Itemname=i.getItemname(); String price= i.getPrice(); return i; }
Making an Optional Request Parameter
@GetMapping("/api/foos") @ResponseBody public String getFoos(@RequestParam(required = false) String id) { return "ID: " + id; }
References
https://stackoverflow.com/questions/32201441/how-do-i-retrieve-query-parameters-in-spring-boot
https://www.baeldung.com/spring-request-param