Issue
I'm using the Java Spring framework to map data from a portion of my data and my @pathvariable won't get me access to any data. all I;m getting in the console is
bash: localhost:4001/traveladventures/bycountry/Greece: No such file or directory
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import java.util.List;
@GetMapping()
public Iterable<Adventure> getAllAdventures(){
return this.adventureRepository.findAll();
}
@GetMapping("/bycountry/{country}")
public List<Adventure> getByCountry(@PathVariable("country") String country){
return this.adventureRepository.findByCountry(country);
}
my data is comming in through sql and I'm using this interface to get access to the data
public interface AdventureRepository extends CrudRepository<Adventure, Integer> {
public List<Adventure> findByCountry(String country);
public List<Adventure> findByState(String state);
}
Solution
Try This command
Blockquote
curl -v http://localhost:4001/traveladventures/bycountry/Greece
Answered By - Abdelkader Chhaibi
Answer Checked By - Timothy Miller (JavaFixing Admin)