naresh2016 / NeverGiveup

0 stars 0 forks source link

Error: Ambiguous handler methods mapped for HTTP path in spring data rest #1

Open naresh2016 opened 8 years ago

naresh2016 commented 8 years ago

@Import(Appconfig.class) @RestController //@RequestMapping("/api/destination/find") public class RestApi01_Controller {

@Autowired
public CountryRepo Country_Repository;

@Autowired
public CityRepo City_Repository;

@Autowired
public AirportRepo Airport_Repository;

@Autowired
public ResortRepo  Resort_Repository;

@RequestMapping(value="/api/destination/find/{city}", method=RequestMethod.GET) public List getCity(@PathVariable String city) {

    return City_Repository.findByCityLikeIgnoreCase(city);

}

@RequestMapping(value="/api/destination/find/{airportname}", method=RequestMethod.GET)
public List<Master_Airport> getAirportname(@PathVariable String airportname) {

    return Airport_Repository.findByAirportnameLikeIgnoreCase(airportname);

}

@RequestMapping(value="/api/destination/find/{resortname}", method=RequestMethod.GET) public List getResortname(@PathVariable String resortname) {

    return ResortRepository.findByResortnameLikeIgnoreCase(resortname);

} }

naresh2016 commented 8 years ago

my reqirements are : if a user enters "Lon", then "Request: /api/destination/find/Lon Response: [{""city"": { {""city"": ""London"", ""indexid"":12355}, {""airport"": {""airportcode"":""LCY"", ""airportname"": ""London City Airport""}, {""airportcode"":""LHR"", ""airportname"": ""London Heathrow""},{""resort"": {""resortname"": ""London E Postcodes"", ""indexid"":26447}}