Multiple @RequestMapping for a method in Controller class in Spring Boot

Multiple @RequestMapping for a method in Controller class in Spring Boot



Yes it is possible @RestController public class UnitsController { @Autowired UnitDataRepository unitDataRepository; @RequestMapping({"/plugMillingDatas/unitData", "/bhaDatas/unitData"}) public ResponseEntity getModalBasedUOMData (@RequestParam (value = "modalClass", required = true) String modalClass) { UnitData unitData = unitDataRepository.findByModalClass(modalClass); return ResponseEntity.ok(unitData.getUnits().replace("\\\"", "\"").toString()); } } Hope this helps ðŸ™‚   

No comments:

 Python Basics How to check the version of Python interpreter mac terminal

Popular in last 30 days