Spring MVC Configuration with Hibernate in Eclipse - maven
Description
Easy and well define spring mvc configuration with ORM hibernate, Project Management Tool Maven and Client Side Programming Language Javascript's plugin JQuery in widely used Integrated Development Environment (IDE) Tool Eclipse Luna
Spring MVC Configuration with Hibernate in Eclipse
In this video tutorial, we will start to create spring project from scratch to perform some common actions like creating a new record, updating an existing record, reading an existing record and deleting an existing record.
Note: In this project we are using Eclipse IDE, Maven dependency management tool and JQuery.
Step 1: Create a new maven
- In Eclipse > File > New maven project > Next
- Select maven-archetypes-webapp Archetypes > Next
- write Group Id, Artifact Id, Version and Package. > Finish
Step 2: Add a new packages.
Note: Having created maven project, You will find main > Java and webapp packages.
Add following six packages in Java directory.
- com.controllers
- com.daoapi
- com.daoimpl
- com.entities
- com.servicesapi
- com.servicesimpl
Step 3: Update POM file
Note: This file contains list of java dependencies for our spring project.
filename: pom.xml
Step 3: Create a deployment descriptor
Note: In deployment descriptor we add entry for front end spring controller to handle http requests.
filename: web.xml
location: project root / src / main / webapp / WEB-INF
Step 4: Create an application context.
Note: Application context file is the spring configurations for the applications.
filename: applicationContext.xml
location: project root / src / main / webapp / WEB-INF
Step 5: Create Servlet configuration file
Note: Servlet configuration file contains all configurable beans for a servlet.
filename: SpringMVC-servlet.xml
Location: project root / src / main / webapp / WEB-INF
Step 6: Create a view
- View is for displaying data and form.
- This view contains JavaScript for creating, updating, reading and deleting record.
filename: users.jsp
location: project root / src / main / webapp / WEB-INF / views
Step 7: Create an entity
Note: Entity is a model class for a database table.
filename: Users.java
package: com.entities
location: project root / src / main / java / com / entities
Step 8: Create Service API and Service Impl
filename: UsersService.java
package: com.servicesapi
location: project root / src / main / java / com / servicesapi
filename: UsersServiceImpl.java
package: com.servicesimpl
location: project root / src / main / java / com / servicesimpl
Step 8: Create DAO API and DAO Impl
filename: UsersDao.java
package: com.daoapi
location: project root / src / main / java / com / daoapi
filename: UsersImpl.java
package: com.daoimpl
location: project root / src / main / java / com / daoimpl