Single Page App with Spring and AngularJS

Spring is a very comprehensive framework for Java and is ideal for backend serverside functionality of an application. It supports RESTful services and I will show how it can be integrated with Angular JS, a front-end client side Javascript based framework. RESTful api’s can be built independently by building a controller, service factory and a view layer for each functional use case API aka Single Page App. Several of these Single Page Apps can be developed and integrated together in an Agile development fashion with minimal impact because these new Single Page Apps benefit with loosely coupled architecture.

 

The architecture of a Spring + Angular single page web app

Form-intensive enterprise class applications are ideally suited for being built as single page web apps. The main idea compared to other more traditional server-side architectures is to build the server as a set of stateless reusable REST services, and from an MVC perspective to take the controller out of the backend and move it into the browser:

SpringMVCAngular2.jpg

The client is MVC-capable and contains all the presentation logic which is separated in a view layer, a controller layer and a frontend services layer. After the initial application startup, only JSON data goes over the wire between client and server.

 

References

admin has written 55 articles