Before we start, please take some time to review our existing application: Spring MVC 3.1, jqGrid, and Spring Data JPA Integration Guide. If all you need is a pure Spring Data Rest application, please visit the official Spring Data Rest starter web application.
Table of Contents
Part 1: Configuration- Update the pom.xml
- Update the web.xml
- Spring Configurations
- Repositories
Dependencies
- Spring core 3.2.0.RC1
- Spring Data Rest 1.0.0.RC3
- Spring Data JPA 1.1.0.RELEASE
- jQuery 1.6.4
- jqGrid 4.3.1
- See pom.xml for details
Github
To access the source code, please visit the project's Github repository (click here)
Update the pom.xml
Here are the changes that we need to do:- Update the Spring core version
- Update the Spring Data JPA version
- Add Spring Data Rest dependency
Note: I also added the profiles section at the end of the pom.xml, so that we can expose the repositories in a clean manner.
Update the web.xml
Here are the changes that we need to do:- Update the web-app version to 2.5 (optional)
- Update the display-name (optional)
- Add Spring Data Rest servlet
Spring Configurations
We need to do three tasks:- Update the database name
- Create a spring-data-rest.xml
- Update the applicationContext.xml
Update the database name
Open the spring.properties under WEB-INF folder, and update it as follows:In the original application, the declared database name is spring_jqgrid_tutorial, let's update it to spring_data_rest_tutorial (though this is really not needed).
Create a spring-data-rest.xml
Update the applicationContext.xml
There's not much update here. We just need to import the spring-data-rest.xml as follows:Repositories
We need to do two tasks:- Update UserRepository
- Create a new repository RoleRepository
The only update here is the addition of the annotation @Param to the UserRepository. This is required so that we can expose the parameters in the search queries.
We need to create a new repository for the Role domain so that we can expose it as RESTful endpoint:
Next
In the next section, we will build and run the application and test our RESTful endpoints. Click here to proceed.
Share the joy:
|
Subscribe by reader Subscribe by email Share
This is perfect, jsut what I looking for, just one update, for spring-data-rest-webmvc version: 1.1.0.M1I had to use
ReplyDeleteorg.springframework.data.rest.webmvc.RepositoryRestDispatcherServlet
instead of
org.springframework.data.rest.webmvc.RepositoryRestExporterServlet
Also comment out this in spring-data-rest.xml , since "RepositoryRestConfiguration" has been removed in 1.1.0.M1 version as well.
ReplyDeleteIs anyone else getting "Dependency not found" for version 1.1.0.M1?
ReplyDeleteYes, me too.
ReplyDeleteStill no idea yet, how to fix it.
Added the following maven repositories in pom.xml for getting the version 1.1.0.M1:
ReplyDeleteid: com.springsource.repository.bundles.release
url: http://repository.springsource.com/maven/bundles/release
id: com.springsource.repository.bundles.external
url: http://repository.springsource.com/maven/bundles/external
id: com.springsource.repository.libs-snapshot
url: http://repo.springsource.org/libs-snapshot
Regards,
Matthias
How to get the primary key value like ("ID")
ReplyDeleteSuperbly written article, if only all bloggers offered the same content as you, the internet would be a far better place.. Wondering where to go in 2019? Things to do has ranked as the best include a remote, idyllic island, the design capital ...
ReplyDeleteEffective blog with a lot of information. I just Shared you the link below for Courses .They really provide good level of training and Placement,I just Had Spring Classes in this institute , Just Check This Link You can get it more information about the Spring course.
ReplyDeleteJava training in chennai | Java training in annanagar | Java training in omr | Java training in porur | Java training in tambaram | Java training in velachery
I enjoyed your blog Thanks for sharing such an informative post. We are also providing the best services click on below links to visit our website.
Deletedigital marketing company in nagercoil
digital marketing services in nagercoil
digital marketing agency in nagercoil
best marketing services in nagercoil
SEO company in nagercoil
SEO services in nagercoil
social media marketing in nagercoil
social media company in nagercoil
PPC services in nagercoil
digital marketing company in velachery
digital marketing company in velachery
digital marketing services in velachery
digital marketing agency in velachery
SEO company in velachery
SEO services in velachery
social media marketing in velachery
social media company in velachery
PPC services in velachery
online advertisement services in velachery
online advertisement services in nagercoil
web design company in nagercoil
web development company in nagercoil
website design company in nagercoil
website development company in nagercoil
web designing company in nagercoil
website designing company in nagercoil
best web design company in nagercoil
web design company in velachery
web development company in velachery
website design company in velachery
website development company in velachery
web designing company in velachery
website designing company in velachery
best web design company in velachery
Thanks for Sharing - ( Groarz branding solutions )
nike off white
ReplyDeleteggdb outlet
jordan 13
jordan outlet
yeezy gap hoodie
jordan 12
off white t shirt
off white
golden goose
gap yeezy