Spring MVC CRUD Application with MySQL and Hibernate is a full package of Spring MVC basic Applicaiton MVC Style of Spring development in Java. This application explains how the view is configured, how the controller is closely connected with view and somewhat with model. The application also connects with MySQL using Hibernate, so this also gives basic Idea about Spring MVC Application data connectivity.
In this post, we will see how we can execute a simple program for Spring MVC CRUD Application with MySQL and Hibernate.
- Prerequisite
Java must be installed first.
You will also need Maven Setup done already on your machine.
You will need an IDE like Eclipse to build and execute the project.
You will also need the MySQL to be installed in the same machine.
Find the Source Code on GitHub: Spring MVC CRUD Application with MySQL and Hibernate.
- Spring MVC CRUD Application with MySQL and Hibernate
Once above pre-requisites are done, use the GitHub project to clone and execute. Check program instructions as below.
- Once the JDK and Maven setup is done. In any of the empty directory checkout the Git project for springmvc-crud-app. This will be your workspace with eclipse to execute or modify the springmvc-crud-app Java Source code.
-
The springmvc-crud-app program will be created in Eclipse and it will have /src/main/java/ folder for writing java source code.
Create database in MySQL using create database schoolDB query in any Database Client tool like Workbench.Now, run the Maven command from this Project folder to build the project and run, mvn clean install.
Alternatively, the package can be created in target folder as below.
target/SpringMVCCRUDApp.warTo Run this program you will require external tomcat. Please make sure that you have installed tomcat which is also configured in your current eclipse workspace.
Then use the URL
http://localhost:8080/SpringMVCCRUDApp/ to execute
and see the result on browser. The default port for tomcat will be 8080.
Here are some CRUD operations that you can perform using this application on Student Data Model.Add New Student Form
Add New Student Success
Modify Student Click
Modify Student Form
Modify Student Success
Delete Student Click
Delete Student Success
Student Form Validation
So here we are done with the basic program for Spring MVC CRUD Application with MySQL and Hibernate.