Introduction to Spring MVC + Hibernate with AngularJS

Background and Pre-request

Developers always talk about Spring and Hibernate. In fact, they are two different frameworks. But, working closely together very well, and forming MVC (Model-View-Controller) framework. Spring is one of the most famous Java application framework, constructing Controllers and Views (JSP). Hibernate is an ORM (object-relational mapping) framework, constructing Models.

 

This blog will show you by different examples how to build Spring MVC + Hibernate ORM models with AngularJS web application step by step, layer by layer. After going through our examples, you should be able to handle Spring and Hibernate frameworks.

 

Before the examples, you need to have:

  1. Java JDK 1.7 or later
  2. Eclipse 4.5.1 Mars or later
  3. Tomcat 7 or later
  4. MySQL 5.7 or later
  5. Maven plug-in (m2e)

 

With Eclipse Mars, you don’t need to install the Maven, because starting from Eclipse 4.3 Kepler, it already includes the Maven so that you don’t need to install Maven plug-in (m2e).

Please make sure:

  1. Install MySQL (using 5.7 for our example), you can download from http://dev.mysql.com/downloads/mysql/
  2. Install JDK from Oracle (using JDK 1.7 for our example), you can download from http://www.oracle.com/technetwork/java/javase/downloads/index.html
  3. Setup JAVA_HOME path

a. Right-click on “Computer”, and click on “Properties”.

b. Click on “Change Settings”

c. Click on “Environment Variables”

d. Under “User variables for XXXX”, click on “New” button to create a new user variable.

Input “JAVA_HOME” as variable name and C:\{your_java_installed_path}\jdk1.7.0_55 as your variable value. If you are using different version of JDK, please update the path value.

  1. Download and install Eclipse (prefer Eclipse Mars or upper), you can download from https://eclipse.org/downloads/
  2. Download and install Tomcat (prefer Tomcat 8 or upper) from http://tomcat.apache.org/download-80.cgi
  3. After installed JDK, Tomcat and Eclipse, you can setup the JDK version and Server Runtime for your Eclipse.
  4. Open the Eclipse
  5. Setup the JDK version : select “Window” => “Preferences” => “Java” => “Installed JREs” => setup your JRE home path:
  6. Setup the Server Runtime : select “Window” => “Preferences” => “Server” => “Runtime Environments” => click “Add…”

 

Click “Next”, and fill in your tomcat installed path:

Click “Finish” to save it.

 

Development environment has been setup successfully, you can now start playing with the examples.

Please rate this