Use the following commands to build run the application:
$ mvn clean package
$ java -jar target/livelessons-data-rest-1.0.0-SNAPSHOT.jar
Note that integration tests for the REST functionality will be executed as part of the
Maven build process. See the DataRestApplicationTest
class.
This is exactly the same code as the JPA example, except we have an additional
spring-boot-starter-data-rest
dependency. The CarRepository
also includes a couple
of new annotations. The @RestResource(path="find")
provides a nicer name for the search
URL and @Param("make")
is used to indicate the name of the query parameter.
Once running you can open a browser to http://localhost:8080/cars to navigate the elements. To perform a search you can use URLs in the form http://localhost:8080/cars/search/find?make=honda.