Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

I'm using Java Spring framework to map data from a portion of my data and my pathvariable won't get me access to any data

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);
}

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Try This command

Blockquote

curl -v http://localhost:4001/traveladventures/bycountry/Greece

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading