{"id":21563,"date":"2018-05-03T16:15:38","date_gmt":"2018-05-03T13:15:38","guid":{"rendered":"http:\/\/www.webcodegeeks.com\/?p=21563"},"modified":"2018-05-03T15:04:53","modified_gmt":"2018-05-03T12:04:53","slug":"angularjs-with-spring-mvc-example","status":"publish","type":"post","link":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angularjs-with-spring-mvc-example\/","title":{"rendered":"AngularJS with Spring MVC Example"},"content":{"rendered":"<p>Hello readers, in this tutorial we will create a simple application that uses the spring and angular framework. For this tutorial, we\u2019ll have a button that will display the user details when it is clicked.<\/p>\n<h2>1. Introduction<\/h2>\n<p>It is very simple, but before moving further let&#8217;s take a look at the Spring, Spring MVC, and Angular framework.<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n[ulp id=&#8217;LXJcMJZXSsqGXYW8&#8242;]<\/p>\n<h3>1.1 Spring framework<\/h3>\n<ul>\n<li>Spring is an open-source framework created to address the complexity of an enterprise application development<\/li>\n<li>One of the chief advantages of the Spring framework is its layered architecture, which allows a developer to be selective about which of its components they can use while providing a cohesive framework for <code>J2EE<\/code> application development<\/li>\n<li>Spring framework provides support and integration to various technologies for e.g.:\n<ul>\n<li>Support for Transaction Management<\/li>\n<li>Support for interaction with the different databases<\/li>\n<li>Integration with the Object Relationship frameworks for e.g. Hibernate, iBatis etc<\/li>\n<li>Support for <span style=\"text-decoration: underline;\">Dependency Injection<\/span> which means all the required dependencies will be resolved with the help of containers<\/li>\n<li>Support for <code>REST<\/code> style web-services<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>1.1.1 Spring MVC framework<\/h4>\n<p><span style=\"text-decoration: underline;\">Model-View-Controller<\/span> (MVC) is a well-known design pattern for designing the GUI based applications. It mainly decouples the business logic from UI by separating the roles of <strong>M<\/strong>odel, <strong>V<\/strong>iew, and <strong>C<\/strong>ontroller in an application. This pattern divides the application into three components to separate the internal representation of the information from the way it is being presented to the user. The three components are:<\/p>\n<ul>\n<li><span style=\"text-decoration: underline;\">Model (M)<\/span>: Model\u2019s responsibility is to manage the application&#8217;s data, business logic, and the business rules. It is a <code>POJO<\/code> class which encapsulates the application data given by the controller<\/li>\n<li><span style=\"text-decoration: underline;\">View (V)<\/span>: A view is an output representation of the information, such as displaying information or reports to the user either as a text-form or as charts. Views are usually the <code>JSP<\/code> templates written with Java Standard Tag Library (<code>JSTL<\/code>)<\/li>\n<li><span style=\"text-decoration: underline;\">Controller (C)<\/span>: Controller\u2019s responsibility is to invoke the Models to perform the business logic and then update the view based on the model\u2019s output. In spring framework, the controller part is played by the Dispatcher Servlet<\/li>\n<\/ul>\n<figure id=\"attachment_21602\" aria-describedby=\"caption-attachment-21602\" style=\"width: 514px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/mvc_overview.jpg\"><img decoding=\"async\" class=\"wp-image-21602 size-full\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/mvc_overview.jpg\" alt=\"Fig. 1: Model View Controller (MVC) Overview\" width=\"514\" height=\"326\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/mvc_overview.jpg 514w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/mvc_overview-300x190.jpg 300w\" sizes=\"(max-width: 514px) 100vw, 514px\" \/><\/a><figcaption id=\"caption-attachment-21602\" class=\"wp-caption-text\">Fig. 1: Model View Controller (MVC) Overview<\/figcaption><\/figure>\n<h3>1.2 Angular framework<\/h3>\n<p><em>Angular<\/em> is a JavaScript MVC or Model-View-Controller framework developed by Google that lets developers build well structured, easily testable, and maintainable front-end applications. But before we start creating a real application using the angular library, let us see what the important parts of an angular application are.<\/p>\n<h4>1.2.1 Templates<\/h4>\n<p>In Angular, a <span style=\"text-decoration: underline;\">template<\/span> is an <code>HTML<\/code> with added markups. The angular library compiles the templates and renders the resultant <code>HTML<\/code> page.<\/p>\n<h4>1.2.2 Directives<\/h4>\n<p><span style=\"text-decoration: underline;\">Directives<\/span> are the markers (i.e. attributes) on a DOM element that tell angular to attach a specific behavior to that DOM element or even transform the DOM element and its children. Most of the directives in the angular library start with the <code>ng<\/code>.<\/p>\n<h4>1.2.3 Expressions<\/h4>\n<p>An <span style=\"text-decoration: underline;\">expression<\/span> is like a JavaScript code usually wrapped inside the double curly braces such as <code>{{ expression }}<\/code>. Angular library evaluates the expression and produces a result.<\/p>\n<p>These new APIs make developer&#8217;s life easier, really! But it would be difficult for a beginner to understand this without an example. Therefore, let us create a simple application using the Spring and Angular libraries.<\/p>\n<h2>2. AngularJS with Spring MVC Example<\/h2>\n<p>Here is a step-by-step guide for implementing Spring MVC architecture in the angular web applications.<\/p>\n<h3>2.1 Tools Used<\/h3>\n<p>We are using Eclipse Kepler SR2, JDK 8 and Maven. Having said that, we have tested the code against JDK 1.7 and it works well.<\/p>\n<h3>2.2 Project Structure<\/h3>\n<p>Firstly, let\u2019s review the final project structure if you are confused about where you should create the corresponding files or folder later!<\/p>\n<figure id=\"attachment_21565\" aria-describedby=\"caption-attachment-21565\" style=\"width: 264px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/angular_spring_ex_project_structure_guide_1.jpg\"><img decoding=\"async\" class=\"size-full wp-image-21565\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/angular_spring_ex_project_structure_guide_1.jpg\" alt=\"Fig. 2: Application Project Structure\" width=\"264\" height=\"468\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/angular_spring_ex_project_structure_guide_1.jpg 264w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/angular_spring_ex_project_structure_guide_1-169x300.jpg 169w\" sizes=\"(max-width: 264px) 100vw, 264px\" \/><\/a><figcaption id=\"caption-attachment-21565\" class=\"wp-caption-text\">Fig. 2: Application Project Structure<\/figcaption><\/figure>\n<h3>2.3 Project Creation<\/h3>\n<p>This section will show how to create a Java-based Maven project with Eclipse. In Eclipse Ide, go to <code>File -&gt; New -&gt; Maven Project<\/code>.<\/p>\n<figure id=\"attachment_21566\" aria-describedby=\"caption-attachment-21566\" style=\"width: 657px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/angular_spring_ex_project_guide_1.jpg\"><img decoding=\"async\" class=\"size-full wp-image-21566\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/angular_spring_ex_project_guide_1.jpg\" alt=\"Fig. 3: Create Maven Project\" width=\"657\" height=\"690\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/angular_spring_ex_project_guide_1.jpg 657w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/angular_spring_ex_project_guide_1-286x300.jpg 286w\" sizes=\"(max-width: 657px) 100vw, 657px\" \/><\/a><figcaption id=\"caption-attachment-21566\" class=\"wp-caption-text\">Fig. 3: Create Maven Project<\/figcaption><\/figure>\n<p>In the New Maven Project window, it will ask you to select project location. By default, &#8216;Use default workspace location&#8217; will be selected. Just click on next button to proceed.<\/p>\n<figure id=\"attachment_21567\" aria-describedby=\"caption-attachment-21567\" style=\"width: 598px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/angular_spring_ex_project_guide_2.jpg\"><img decoding=\"async\" class=\"size-full wp-image-21567\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/angular_spring_ex_project_guide_2.jpg\" alt=\"Fig. 4: Project Details\" width=\"598\" height=\"543\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/angular_spring_ex_project_guide_2.jpg 598w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/angular_spring_ex_project_guide_2-300x272.jpg 300w\" sizes=\"(max-width: 598px) 100vw, 598px\" \/><\/a><figcaption id=\"caption-attachment-21567\" class=\"wp-caption-text\">Fig. 4: Project Details<\/figcaption><\/figure>\n<p>Select the &#8216;Maven Web App&#8217; Archetype from the list of options and click next.<\/p>\n<figure id=\"attachment_21568\" aria-describedby=\"caption-attachment-21568\" style=\"width: 597px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/angular_spring_ex_project_guide_3.jpg\"><img decoding=\"async\" class=\"size-full wp-image-21568\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/angular_spring_ex_project_guide_3.jpg\" alt=\"Fig. 5: Archetype Selection\" width=\"597\" height=\"541\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/angular_spring_ex_project_guide_3.jpg 597w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/angular_spring_ex_project_guide_3-300x272.jpg 300w\" sizes=\"(max-width: 597px) 100vw, 597px\" \/><\/a><figcaption id=\"caption-attachment-21568\" class=\"wp-caption-text\">Fig. 5: Archetype Selection<\/figcaption><\/figure>\n<p>It will ask you to &#8216;Enter the group and the artifact id for the project&#8217;. We will enter the details as shown in the below image. The version number will be by default: <code>0.0.1-SNAPSHOT<\/code>.<\/p>\n<figure id=\"attachment_21569\" aria-describedby=\"caption-attachment-21569\" style=\"width: 596px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/angular_spring_ex_project_guide_4.jpg\"><img decoding=\"async\" class=\"size-full wp-image-21569\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/angular_spring_ex_project_guide_4.jpg\" alt=\"Fig. 6: Archetype Parameters\" width=\"596\" height=\"537\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/angular_spring_ex_project_guide_4.jpg 596w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/angular_spring_ex_project_guide_4-300x270.jpg 300w\" sizes=\"(max-width: 596px) 100vw, 596px\" \/><\/a><figcaption id=\"caption-attachment-21569\" class=\"wp-caption-text\">Fig. 6: Archetype Parameters<\/figcaption><\/figure>\n<p>Click on Finish and the creation of a maven project is completed. If you see, it has downloaded the maven dependencies and a <code>pom.xml<\/code> file will be created. It will have the following code:<\/p>\n<p><span style=\"text-decoration: underline;\"><em>pom.xml<\/em><\/span><\/p>\n<pre class=\"brush:xml; wrap-lines:false;\">&lt;project xmlns=\"http:\/\/maven.apache.org\/POM\/4.0.0\" xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" xsi:schemaLocation=\"http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd\"&gt;\r\n\t&lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;\r\n\t&lt;groupId&gt;AngularSpring&lt;\/groupId&gt;\r\n\t&lt;artifactId&gt;AngularSpring&lt;\/artifactId&gt;\r\n\t&lt;version&gt;0.0.1-SNAPSHOT&lt;\/version&gt;\r\n\t&lt;packaging&gt;war&lt;\/packaging&gt;\r\n&lt;\/project&gt;\r\n<\/pre>\n<p>Let\u2019s start building the application!<\/p>\n<h2>3. Application Building<\/h2>\n<p>Let\u2019s create an application to understand the basic building blocks of this tutorial.<\/p>\n<h3>3.1 Maven Dependencies<\/h3>\n<p>In this example, we are using the most stable spring web-mvc, Jackson core, and Log4j version in order to set-up the Spring MVC and Angular functionality. The <strong>updated<\/strong> file will have the following code:<\/p>\n<p><span style=\"text-decoration: underline;\"><em>pom.xml<\/em><\/span><\/p>\n<pre class=\"brush:xml; highlight:[40,41,42,43,44]; wrap-lines:false\">&lt;project xmlns=\"http:\/\/maven.apache.org\/POM\/4.0.0\" xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\r\n\txsi:schemaLocation=\"http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/maven-v4_0_0.xsd\"&gt;\r\n\t&lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;\r\n\t&lt;groupId&gt;AngularSpring&lt;\/groupId&gt;\r\n\t&lt;artifactId&gt;AngularSpring&lt;\/artifactId&gt;\r\n\t&lt;packaging&gt;war&lt;\/packaging&gt;\r\n\t&lt;version&gt;0.0.1-SNAPSHOT&lt;\/version&gt;\r\n\t&lt;name&gt;AngularSpring Maven Webapp&lt;\/name&gt;\r\n\t&lt;url&gt;http:\/\/maven.apache.org&lt;\/url&gt;\r\n\t&lt;dependencies&gt;\r\n\t\t&lt;!-- spring dependency --&gt;\r\n\t\t&lt;dependency&gt;\r\n\t\t\t&lt;groupId&gt;org.springframework&lt;\/groupId&gt;\r\n\t\t\t&lt;artifactId&gt;spring-context&lt;\/artifactId&gt;\r\n\t\t\t&lt;version&gt;5.0.5.RELEASE&lt;\/version&gt;\r\n\t\t&lt;\/dependency&gt;\r\n\t\t&lt;dependency&gt;\r\n\t\t\t&lt;groupId&gt;org.springframework&lt;\/groupId&gt;\r\n\t\t\t&lt;artifactId&gt;spring-core&lt;\/artifactId&gt;\r\n\t\t\t&lt;version&gt;5.0.5.RELEASE&lt;\/version&gt;\r\n\t\t&lt;\/dependency&gt;\r\n\t\t&lt;dependency&gt;\r\n\t\t\t&lt;groupId&gt;org.springframework&lt;\/groupId&gt;\r\n\t\t\t&lt;artifactId&gt;spring-webmvc&lt;\/artifactId&gt;\r\n\t\t\t&lt;version&gt;5.0.5.RELEASE&lt;\/version&gt;\r\n\t\t&lt;\/dependency&gt;\r\n\t\t&lt;!-- jstl dependency --&gt;\r\n\t\t&lt;dependency&gt;\r\n\t\t\t&lt;groupId&gt;javax.servlet&lt;\/groupId&gt;\r\n\t\t\t&lt;artifactId&gt;jstl&lt;\/artifactId&gt;\r\n\t\t\t&lt;version&gt;1.2&lt;\/version&gt;\r\n\t\t&lt;\/dependency&gt;\r\n\t\t&lt;!-- javax servlet api --&gt;\r\n\t\t&lt;dependency&gt;\r\n\t\t\t&lt;groupId&gt;javax.servlet&lt;\/groupId&gt;\r\n\t\t\t&lt;artifactId&gt;javax.servlet-api&lt;\/artifactId&gt;\r\n\t\t\t&lt;version&gt;3.1.0&lt;\/version&gt;\r\n\t\t&lt;\/dependency&gt;\r\n\t\t&lt;!-- spring and json dependency --&gt;\r\n\t\t&lt;dependency&gt;\r\n\t\t\t&lt;groupId&gt;com.fasterxml.jackson.core&lt;\/groupId&gt;\r\n\t\t\t&lt;artifactId&gt;jackson-databind&lt;\/artifactId&gt;\r\n\t\t\t&lt;version&gt;2.9.5&lt;\/version&gt;\r\n\t\t&lt;\/dependency&gt;\r\n\t\t&lt;!-- log4j dependency --&gt;\r\n\t\t&lt;dependency&gt;\r\n\t\t\t&lt;groupId&gt;log4j&lt;\/groupId&gt;\r\n\t\t\t&lt;artifactId&gt;log4j&lt;\/artifactId&gt;\r\n\t\t\t&lt;version&gt;1.2.17&lt;\/version&gt;\r\n\t\t&lt;\/dependency&gt;\r\n\t&lt;\/dependencies&gt;\r\n\t&lt;build&gt;\r\n\t\t&lt;finalName&gt;${project.artifactId}&lt;\/finalName&gt;\r\n\t&lt;\/build&gt;\r\n&lt;\/project&gt;\r\n<\/pre>\n<h3>3.2 Java Class Creation<\/h3>\n<p>Let\u2019s create the different Java files required to carry out this tutorial.<\/p>\n<h4>3.2.1 Implementation of POJO class<\/h4>\n<p>This model class defines the user schema and consists of two properties (i.e. name and department). These properties are used to save the user details and are passed on the view for further processing. Add the following code to it:<\/p>\n<p><span style=\"text-decoration: underline;\"><em>User.java<\/em><\/span><\/p>\n<pre class=\"brush:java; wrap-lines:false;\">package com.jcg.angular.spring;\r\n\r\nimport java.io.Serializable;\r\n\r\npublic class User implements Serializable {\r\n\r\n\tprivate static final long serialVersionUID = 1L;\r\n\r\n\tpublic String name, department;\r\n\r\n\tpublic User() { }\r\n\r\n\tpublic User(String name, String department) {\r\n\t\tthis.name = name;\r\n\t\tthis.department = department;\r\n\t}\r\n\r\n\tpublic String getName() {\r\n\t\treturn name;\r\n\t}\r\n\r\n\tpublic void setName(String name) {\r\n\t\tthis.name = name;\r\n\t}\r\n\r\n\tpublic String getDepartment() {\r\n\t\treturn department;\r\n\t}\r\n\r\n\tpublic void setDepartment(String department) {\r\n\t\tthis.department = department;\r\n\t}\r\n\r\n\t@Override\r\n\tpublic String toString() {\r\n\t\treturn \"User [Name=\" + name + \", Department=\" + department + \"]\";\r\n\t}\r\n}\r\n<\/pre>\n<h4>3.2.2 Implementation of Controller class<\/h4>\n<p>This is a typical spring controller which is annotated by the Spring MVC annotation types. This class consists of the request mapping method which performs the business logic. Let\u2019s write a quick Java program in the spring controller class to handle the <code>HTTP<\/code> request. Add the following code to it.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>UserCtrl.java<\/em><\/span><\/p>\n<pre class=\"brush:java; wrap-lines:false\">package com.jcg.angular.spring;\r\n\r\nimport org.apache.log4j.Logger;\r\nimport org.springframework.http.MediaType;\r\nimport org.springframework.web.bind.annotation.RequestMapping;\r\nimport org.springframework.web.bind.annotation.RequestMethod;\r\nimport org.springframework.web.bind.annotation.ResponseBody;\r\nimport org.springframework.web.bind.annotation.RestController;\r\nimport org.springframework.web.servlet.ModelAndView;\r\n\r\n@RestController\r\npublic class UserCtrl {\r\n\r\n\tprivate static Logger log = Logger.getLogger(UserCtrl.class);\r\n\r\n\t\/\/ Redirects the user to the index page of the application.\r\n\t@RequestMapping(value=\"\/welcome\", method = RequestMethod.GET)\r\n\tpublic ModelAndView index() {\r\n\t\treturn new ModelAndView(\"welcome\");\r\n\t}\r\n\r\n\t\/\/ Sets the dummy user details.\r\n\t@RequestMapping(value = \"\/userlist\", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)\t\r\n\tpublic @ResponseBody User getDetails() {\r\n\t\tlog.info(\"Fetching the user details .... !\");\r\n\r\n\t\tUser user = new User();\r\n\t\tuser.setName(\"Java Code Geek\");\r\n\t\tuser.setDepartment(\"Technical Writing\");\r\n\r\n\t\tlog.info(\"User details are?= \" + user.toString());\r\n\t\treturn user;\r\n\t}\r\n}\r\n<\/pre>\n<h3>3.3 Configuration Files<\/h3>\n<p>Let\u2019s write all the configuration files involved in this tutorial.<\/p>\n<h4>3.3.1 Spring Configuration File<\/h4>\n<p>To configure the spring framework, we need to implement a bean configuration file i.e. <code>spring-servlet.xml<\/code> which provide an interface between the basic Java class and the outside world. Put this <code>XML<\/code> file in the <code>AngularSpring\/src\/main\/webapp\/WEB-INF<\/code> folder and add the following code to it:<\/p>\n<p><span style=\"text-decoration: underline;\"><em>spring-servlet.xml<\/em><\/span><\/p>\n<pre class=\"brush:xml; wrap-lines:false;\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\r\n&lt;beans xmlns=\"http:\/\/www.springframework.org\/schema\/beans\" xmlns:context=\"http:\/\/www.springframework.org\/schema\/context\" xmlns:mvc=\"http:\/\/www.springframework.org\/schema\/mvc\" xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" xsi:schemaLocation=\"http:\/\/www.springframework.org\/schema\/beans  http:\/\/www.springframework.org\/schema\/beans\/spring-beans.xsd  http:\/\/www.springframework.org\/schema\/context  http:\/\/www.springframework.org\/schema\/context\/spring-context.xsd  http:\/\/www.springframework.org\/schema\/mvc  http:\/\/www.springframework.org\/schema\/mvc\/spring-mvc.xsd\"&gt;\r\n   \r\n   &lt;context:component-scan base-package=\"com.jcg.angular.spring\" \/&gt;\r\n   &lt;mvc:annotation-driven \/&gt;\r\n   \r\n   &lt;!-- Resolves Views Selected For Rendering by @Controllers to *.jsp Resources in the \/WEB-INF\/ Folder --&gt;\r\n   &lt;bean class=\"org.springframework.web.servlet.view.InternalResourceViewResolver\"&gt;\r\n      &lt;property name=\"prefix\" value=\"\/WEB-INF\/views\/\" \/&gt;\r\n      &lt;property name=\"suffix\" value=\".jsp\" \/&gt;\r\n   &lt;\/bean&gt;\r\n&lt;\/beans&gt;\r\n<\/pre>\n<h4>3.3.2 Web Deployment Descriptor<\/h4>\n<p>The <code>web.xml<\/code> file declares one servlet (i.e. Dispatcher Servlet) to receive all kind of the requests and the default welcome page when accessing the application. Add the following code to it:<\/p>\n<p><span style=\"text-decoration: underline;\"><em>web.xml<\/em><\/span><\/p>\n<pre class=\"brush:xml; wrap-lines:false;\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\r\n&lt;web-app xmlns=\"http:\/\/java.sun.com\/xml\/ns\/javaee\" xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" version=\"2.5\" xsi:schemaLocation=\"http:\/\/java.sun.com\/xml\/ns\/javaee              http:\/\/java.sun.com\/xml\/ns\/javaee\/web-app_2_5.xsd\"&gt;\r\n    \r\n    &lt;display-name&gt;AngularSpring&lt;\/display-name&gt;\r\n    \r\n    &lt;!-- Spring Configuration - Processes Application Requests --&gt;\r\n    &lt;servlet&gt;\r\n        &lt;servlet-name&gt;SpringController&lt;\/servlet-name&gt;\r\n        &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;\/servlet-class&gt;\r\n        &lt;init-param&gt;\r\n            &lt;param-name&gt;contextConfigLocation&lt;\/param-name&gt;\r\n            &lt;param-value&gt;\/WEB-INF\/spring-servlet.xml&lt;\/param-value&gt;\r\n        &lt;\/init-param&gt;\r\n        &lt;load-on-startup&gt;1&lt;\/load-on-startup&gt;\r\n    &lt;\/servlet&gt;\r\n    &lt;servlet-mapping&gt;\r\n        &lt;servlet-name&gt;SpringController&lt;\/servlet-name&gt;\r\n        &lt;url-pattern&gt;\/&lt;\/url-pattern&gt;\r\n    &lt;\/servlet-mapping&gt;\r\n    \r\n    &lt;!-- Welcome File List --&gt;\r\n    &lt;welcome-file-list&gt;\r\n        &lt;welcome-file&gt;index.jsp&lt;\/welcome-file&gt;\r\n    &lt;\/welcome-file-list&gt;\r\n&lt;\/web-app&gt;\r\n<\/pre>\n<h3>3.4 Creating Angular Views<\/h3>\n<p>Spring MVC supports many types of views for different presentation technologies. These include \u2013 <code>JSP<\/code>, <code>HTML<\/code>, <code>XML<\/code> etc. Let us write a simple view in the <code>AngularSpring\/src\/main\/webapp\/WEB-INF\/<\/code> folder. This page is configured with Angular components and act as an index page for the application. Add the following code to it:<\/p>\n<p><span style=\"text-decoration: underline;\"><em>welcome.jsp<\/em><\/span><\/p>\n<pre class=\"brush:html; wrap-lines:false;\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n\t&lt;head&gt;\r\n\t    &lt;meta http-equiv=\"Content-Type\" content=\"text\/html; charset=UTF-8\"&gt;\r\n\t    &lt;title&gt;Angularjs Spring Mvc Example&lt;\/title&gt;\r\n\t    \r\n\t    &lt;!-- AngularJs Javascript File --&gt;\r\n\t    &lt;script type=\"text\/javascript\" src=\"https:\/\/ajax.googleapis.com\/ajax\/libs\/angularjs\/1.6.5\/angular.min.js\"&gt;&lt;\/script&gt;\r\n\t    \r\n\t    &lt;!-- Bootstrap Css --&gt;\r\n\t    &lt;link rel=\"stylesheet\" href=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/4.0.0\/css\/bootstrap.min.css\"&gt;\r\n\t    &lt;script type=\"text\/javascript\"&gt;\r\n\t        var app = angular.module(\"app\", []);\r\n\t\r\n\t        app.controller(\"ctrl\", ['$scope', '$http', function($scope, $http) {\r\n\t            $scope.err_state = false; \/\/ Set the default error message state\r\n\t            var fetch_usr_app_url = 'http:\/\/localhost:8080\/AngularSpring\/userlist'; \/\/ Set the application url to fetch the user details\r\n\t\r\n\t            \/\/ Fetches the data from the Spring controller\r\n\t            $scope.getData = function() {\r\n\t                $http({\r\n\t                    method: \"GET\",\r\n\t                    url: fetch_usr_app_url,\r\n\t                }).then(function(response) {\r\n\t                    $scope.user = response.data;\r\n\t                    console.log(\"Success\");\r\n\t                }, function(response) {\r\n\t                    $scope.err_state = true;\r\n\t                    console.log(\"Failure\");\r\n\t                });\r\n\t            };\r\n\t        }]);\r\n\t    &lt;\/script&gt;\r\n\t&lt;\/head&gt;\r\n\t&lt;body&gt;\r\n\t    &lt;div id=\"angularSpring\" class=\"container\"&gt;\r\n\t        &lt;h1 align=\"center\" class=\"text-primary\"&gt;AngularJS - Spring Mvc Example&lt;\/h1&gt;\r\n\t        &lt;hr \/&gt;\r\n\t        \r\n\t        &lt;!------ AngularJs and Spring Mvc Example ------&gt;\r\n\t        &lt;div ng-app=\"app\" ng-controller=\"ctrl\"&gt;\r\n\t            &lt;button id=\"submit_btn\" class=\"btn btn-primary\" ng-click=\"getData()\"&gt;Get User&lt;\/button&gt;\r\n\t            &lt;div&gt;\u00a0&lt;\/div&gt;\r\n\t            \r\n\t            &lt;!-- Success Response --&gt;\r\n\t            &lt;div class=\"user_details\" ng-show=\"user != null\"&gt;\r\n\t                &lt;p&gt;Name : {{ user.name }}&lt;\/p&gt;&lt;p&gt;Department : {{ user.department }}&lt;\/p&gt;\r\n\t            &lt;\/div&gt;\r\n\t            &lt;!-- Error Response --&gt;\r\n\t            &lt;div id=\"showError\" ng-show=\"err_state\"&gt;\r\n\t                &lt;span class=\"text-danger\"&gt;Error in retrieving data!&lt;\/span&gt;\r\n\t            &lt;\/div&gt;\r\n\t        &lt;\/div&gt;\r\n\t    &lt;\/div&gt;\r\n\t&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<h2>4. Run the Application<\/h2>\n<p>As we are ready for all the changes, let us compile the project and deploy the application on the Tomcat7 server. To deploy the application on Tomat7, right-click on the project and navigate to <code>Run as -&gt; Run on Server<\/code>.<\/p>\n<figure id=\"attachment_21570\" aria-describedby=\"caption-attachment-21570\" style=\"width: 772px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/angular_spring_ex_project_deploy_guide_1.jpg\"><img decoding=\"async\" class=\"size-full wp-image-21570\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/angular_spring_ex_project_deploy_guide_1.jpg\" alt=\"Fig. 7: How to Deploy Application on Tomcat\" width=\"772\" height=\"435\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/angular_spring_ex_project_deploy_guide_1.jpg 772w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/angular_spring_ex_project_deploy_guide_1-300x169.jpg 300w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/angular_spring_ex_project_deploy_guide_1-768x433.jpg 768w\" sizes=\"(max-width: 772px) 100vw, 772px\" \/><\/a><figcaption id=\"caption-attachment-21570\" class=\"wp-caption-text\">Fig. 7: How to Deploy Application on Tomcat<\/figcaption><\/figure>\n<p>Tomcat will deploy the application in its web-apps folder and shall start its execution to deploy the project so that we can go ahead and test it in the browser.<\/p>\n<h2>5. Project Demo<\/h2>\n<p>Open your favorite browser and hit the following URL to display the welcome page of the application.<\/p>\n<pre class=\"brush:plain; wrap-lines:false;\">http:\/\/localhost:8080\/AngularSpring\/welcome\r\n<\/pre>\n<p>Server name (localhost) and port (8080) may vary as per your Tomcat configuration.<\/p>\n<figure id=\"attachment_21574\" aria-describedby=\"caption-attachment-21574\" style=\"width: 819px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/angular_spring_ex_project_demo_guide_1a.jpg\"><img decoding=\"async\" class=\"size-full wp-image-21574\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/angular_spring_ex_project_demo_guide_1a.jpg\" alt=\"Fig. 8: Application Index page\" width=\"819\" height=\"136\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/angular_spring_ex_project_demo_guide_1a.jpg 819w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/angular_spring_ex_project_demo_guide_1a-300x50.jpg 300w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/angular_spring_ex_project_demo_guide_1a-768x128.jpg 768w\" sizes=\"(max-width: 819px) 100vw, 819px\" \/><\/a><figcaption id=\"caption-attachment-21574\" class=\"wp-caption-text\">Fig. 8: Application Index page<\/figcaption><\/figure>\n<p>Here, as shown in Fig. 9 if the &#8216;<span style=\"text-decoration: underline;\">Get User<\/span>&#8216; button is clicked, the user details are displayed.<\/p>\n<figure id=\"attachment_21575\" aria-describedby=\"caption-attachment-21575\" style=\"width: 819px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/angular_spring_ex_project_demo_guide_2a.jpg\"><img decoding=\"async\" class=\"size-full wp-image-21575\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/angular_spring_ex_project_demo_guide_2a.jpg\" alt=\"Fig. 9: User details\" width=\"819\" height=\"190\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/angular_spring_ex_project_demo_guide_2a.jpg 819w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/angular_spring_ex_project_demo_guide_2a-300x70.jpg 300w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/angular_spring_ex_project_demo_guide_2a-768x178.jpg 768w\" sizes=\"(max-width: 819px) 100vw, 819px\" \/><\/a><figcaption id=\"caption-attachment-21575\" class=\"wp-caption-text\">Fig. 9: User details<\/figcaption><\/figure>\n<p>That\u2019s all for this post. Happy Learning!!<\/p>\n<h2>6. Conclusion<\/h2>\n<p>In this tutorial, developers learned how to create a simple application using the Spring and Angular libraries. Developers can download the sample application as an Eclipse project in the <a href=\"#projectDownload\">Downloads<\/a> section.<\/p>\n<h2><a name=\"projectDownload\"><\/a>7. Download the Eclipse Project<\/h2>\n<p>This was an example of creating a simple application using the Spring MVC and Angular framework.<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here: <a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/05\/AngularSpring.zip\" target=\"_blank\" rel=\"noopener\"><strong>AngularSpring<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Hello readers, in this tutorial we will create a simple application that uses the spring and angular framework. For this tutorial, we\u2019ll have a button that will display the user details when it is clicked. 1. Introduction It is very simple, but before moving further let&#8217;s take a look at the Spring, Spring MVC, and &hellip;<\/p>\n","protected":false},"author":2162,"featured_media":909,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[48,520,266,535],"class_list":["post-21563","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-angular-js","tag-angular","tag-angular-1","tag-angularjs","tag-spring-mvc"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>AngularJS with Spring MVC Example - Web Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"In this tutorial, we will create a simple application that uses the spring and angular framework.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angularjs-with-spring-mvc-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"AngularJS with Spring MVC Example - Web Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, we will create a simple application that uses the spring and angular framework.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angularjs-with-spring-mvc-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webcodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2018-05-03T13:15:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Yatin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Yatin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"13 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angularjs-with-spring-mvc-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angularjs-with-spring-mvc-example\/\"},\"author\":{\"name\":\"Yatin\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/6c946b8aea919fb2cd83fb17268e9367\"},\"headline\":\"AngularJS with Spring MVC Example\",\"datePublished\":\"2018-05-03T13:15:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angularjs-with-spring-mvc-example\/\"},\"wordCount\":1343,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angularjs-with-spring-mvc-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg\",\"keywords\":[\"angular\",\"Angular 1\",\"angularjs\",\"Spring MVC\"],\"articleSection\":[\"Angular.js\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angularjs-with-spring-mvc-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angularjs-with-spring-mvc-example\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angularjs-with-spring-mvc-example\/\",\"name\":\"AngularJS with Spring MVC Example - Web Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angularjs-with-spring-mvc-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angularjs-with-spring-mvc-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg\",\"datePublished\":\"2018-05-03T13:15:38+00:00\",\"description\":\"In this tutorial, we will create a simple application that uses the spring and angular framework.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angularjs-with-spring-mvc-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angularjs-with-spring-mvc-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angularjs-with-spring-mvc-example\/#primaryimage\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angularjs-with-spring-mvc-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JavaScript\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/javascript\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Angular.js\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/javascript\/angular-js\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"AngularJS with Spring MVC Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"name\":\"Web Code Geeks\",\"description\":\"Web Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webcodegeeks\",\"https:\/\/x.com\/webcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/6c946b8aea919fb2cd83fb17268e9367\",\"name\":\"Yatin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/3f011dd665043468ba193f7b07472ebbedfa359cff5e576a91a5901c130ca6f1?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/3f011dd665043468ba193f7b07472ebbedfa359cff5e576a91a5901c130ca6f1?s=96&d=mm&r=g\",\"caption\":\"Yatin\"},\"description\":\"The author is graduated in Electronics &amp; Telecommunication. During his studies, he has been involved with a significant number of projects ranging from programming and software engineering to telecommunications analysis. He works as a technical lead in the information technology sector where he is primarily involved with projects based on Java\/J2EE technologies platform and novel UI technologies.\",\"sameAs\":[\"https:\/\/www.webcodegeeks.com\"],\"url\":\"https:\/\/www.webcodegeeks.com\/author\/yatin-batra\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"AngularJS with Spring MVC Example - Web Code Geeks - 2026","description":"In this tutorial, we will create a simple application that uses the spring and angular framework.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angularjs-with-spring-mvc-example\/","og_locale":"en_US","og_type":"article","og_title":"AngularJS with Spring MVC Example - Web Code Geeks - 2026","og_description":"In this tutorial, we will create a simple application that uses the spring and angular framework.","og_url":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angularjs-with-spring-mvc-example\/","og_site_name":"Web Code Geeks","article_publisher":"https:\/\/www.facebook.com\/webcodegeeks","article_published_time":"2018-05-03T13:15:38+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg","type":"image\/jpeg"}],"author":"Yatin","twitter_card":"summary_large_image","twitter_creator":"@webcodegeeks","twitter_site":"@webcodegeeks","twitter_misc":{"Written by":"Yatin","Est. reading time":"13 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angularjs-with-spring-mvc-example\/#article","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angularjs-with-spring-mvc-example\/"},"author":{"name":"Yatin","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/6c946b8aea919fb2cd83fb17268e9367"},"headline":"AngularJS with Spring MVC Example","datePublished":"2018-05-03T13:15:38+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angularjs-with-spring-mvc-example\/"},"wordCount":1343,"commentCount":0,"publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angularjs-with-spring-mvc-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg","keywords":["angular","Angular 1","angularjs","Spring MVC"],"articleSection":["Angular.js"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angularjs-with-spring-mvc-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angularjs-with-spring-mvc-example\/","url":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angularjs-with-spring-mvc-example\/","name":"AngularJS with Spring MVC Example - Web Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angularjs-with-spring-mvc-example\/#primaryimage"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angularjs-with-spring-mvc-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg","datePublished":"2018-05-03T13:15:38+00:00","description":"In this tutorial, we will create a simple application that uses the spring and angular framework.","breadcrumb":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angularjs-with-spring-mvc-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angularjs-with-spring-mvc-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angularjs-with-spring-mvc-example\/#primaryimage","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angularjs-with-spring-mvc-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"JavaScript","item":"https:\/\/www.webcodegeeks.com\/category\/javascript\/"},{"@type":"ListItem","position":3,"name":"Angular.js","item":"https:\/\/www.webcodegeeks.com\/category\/javascript\/angular-js\/"},{"@type":"ListItem","position":4,"name":"AngularJS with Spring MVC Example"}]},{"@type":"WebSite","@id":"https:\/\/www.webcodegeeks.com\/#website","url":"https:\/\/www.webcodegeeks.com\/","name":"Web Code Geeks","description":"Web Developers Resource Center","publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.webcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webcodegeeks","https:\/\/x.com\/webcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/6c946b8aea919fb2cd83fb17268e9367","name":"Yatin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/3f011dd665043468ba193f7b07472ebbedfa359cff5e576a91a5901c130ca6f1?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3f011dd665043468ba193f7b07472ebbedfa359cff5e576a91a5901c130ca6f1?s=96&d=mm&r=g","caption":"Yatin"},"description":"The author is graduated in Electronics &amp; Telecommunication. During his studies, he has been involved with a significant number of projects ranging from programming and software engineering to telecommunications analysis. He works as a technical lead in the information technology sector where he is primarily involved with projects based on Java\/J2EE technologies platform and novel UI technologies.","sameAs":["https:\/\/www.webcodegeeks.com"],"url":"https:\/\/www.webcodegeeks.com\/author\/yatin-batra\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/21563","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/users\/2162"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/comments?post=21563"}],"version-history":[{"count":0,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/21563\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media\/909"}],"wp:attachment":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media?parent=21563"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/categories?post=21563"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/tags?post=21563"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}