Spring Boot MVC AutoComplete using jQuery

Introduction

Autocomplete allows you to easily create autocomplete and auto-suggest boxes for text input fields. When you start a search on Google, you can find the information you are looking for using search predictions. Search predictions are possible search terms you can use that are related to the terms you are typing and what other people are searching for. Spring Boot MVC autocomplete example will show you exactly the same thing here.

Autocomplete is a feature in which an application predicts the rest of a word a user is typing. In graphical user interfaces, users can typically press the tab key to accept a suggestion or the down arrow key to accept one of several.
Autocomplete speeds up human-computer interactions when it correctly predicts the word a user intends to enter after only a few characters have been typed into a text input field. The autocomplete is a normal text input enhanced by a panel of suggested options. Continue reading “Spring Boot MVC AutoComplete using jQuery”

Server Sent Events with Spring – Push Notifications

Introduction

We have seen a popular choice for sending real time data from server to client in web application is using WebSocket in our previous tutorials Messaging with STOMP over WebSockets using Spring and ActiveMQ and Spring Boot WebSocket AngularJS Gradle Example. WebSocket opens bidirectional connections between server and client. So both server and client can send messages. But sometimes we face situations, where the application needs only one way communication, i.e., sending data from server to the client and for this Spring provides a simpler solution using Server Sent Events (SSE). SSE is a technology that allows you to stream data from server to the browser  (Push Notifications) within one HTTP connection in one direction. For example, pushing stock price changes in real-time or showing progress of long-running process or real time showing of cricket or football scores on display board etc.

Browser Support

SSE are supported in most modern browsers. Only Microsoft’s IE and Edge browsers do not have a built in implementation. But there is a way out because Server-Sent Events uses common HTTP connections and can therefore be implemented with the following libraries to support IE and Edge browsers.

Continue reading “Server Sent Events with Spring – Push Notifications”

Spring MVC + AngularJS CRUD Example

In this tutorial we will see the integration of AngularJS with Spring MVC. We are going to create CRUD application using Spring REST API on server side and AngularJS is encapsulated within JSP file on client side. Thus the client will communicate with server asynchronously using AngularJS $http service.

If you need PHP version http://www.roytuts.com/angularjs-php-rest-crud-example/

If you need Codeigniter version http://www.roytuts.com/angularjs-codeigniter-rest-crud-example/

Prerequisites
Eclipse Neon
Maven 3.3.9
Java 1.8
Spring 4.3.8.RELEASE
Jackson 2.5.3
AngularJS 1.6.4

Continue reading “Spring MVC + AngularJS CRUD Example”

Spring Asynchronous Execution using @Async

In this tutorial we will discuss about the asynchronous execution support in Spring using the @Async annotation. There are cases in which @Async is necessary to execute piece of code asynchronous. An example would be while sending a (JMS) message from one system to another system. The advantage is that the user does not have to wait for the response while the message is being send.
@Async annotation on a method of a bean will execute in a separate thread i.e. the caller does not need to wait for the completion of the called method.

Continue reading “Spring Asynchronous Execution using @Async”

Spring Boot MVC with Tiles and AJAX

In my previous tutorials I have shown how to create a Spring Boot MVC application, here I will show you how to create an AJAX based Spring Boot MVC application with Tiles.

What is Tiles (https://tiles.apache.org/)

A free open-sourced templating framework for modern Java applications.
Based upon the Composite pattern it is built to simplify the development of user interfaces.

For complex web sites it remains the easiest and most elegant way to work alongside any MVC technology.

In summary, tiles allows authors to define page fragments which can be assembled into a complete pages at runtime. These fragments, or tiles, can be used as simple includes in order to reduce the duplication of common page elements or embedded within other tiles to develop a series of reusable templates. These templates streamline the development of a consistent look and feel across an entire application.

Continue reading “Spring Boot MVC with Tiles and AJAX”

Spring Boot MVC with Maven

The primary motivation behind developing Spring Boot is to simplify the process for configuring and deploying the spring applications. Spring Boot will get rid of all the fuss involved on configuring the dependencies for building the enterprise applications. In Spring based applications, configurations are loaded with a bunch of XML files, now these configurations should not be maintained in a separate file which is extra work for the developers. Developers need to focus on only writing the application while Spring Boot will simplify the deployment process by packaging and deploying application without any explicit configurations.

You may also read Spring Boot MVC with Tiles and AJAX and https://www.jeejava.com/spring-mvc-and-jdbc-crud-with-zero-xml/

More information can be found here http://projects.spring.io/spring-boot/

Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can “just run”. We take an opinionated view of the Spring platform and third-party libraries so you can get started with minimum fuss. Most Spring Boot applications need very little Spring configuration.
Features

Create stand-alone Spring applications
Embed Tomcat, Jetty or Undertow directly (no need to deploy WAR files)
Provide opinionated ‘starter’ POMs to simplify your Maven configuration
Automatically configure Spring whenever possible
Provide production-ready features such as metrics, health checks and externalized configuration
Absolutely no code generation and no requirement for XML configuration

The reference guide includes detailed descriptions of all the features http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/.

Continue reading “Spring Boot MVC with Maven”

Spring MVC and JDBC CRUD with zero XML

In my other tutorials Spring MVC CRUD example with JDBC Spring MVC and Spring JDBC ExampleSpring MVC and JDBC CRUD Example  I have used XML configurations but in this tutorial I have used only Annotation, so it means it uses zero XML configurations. This example shows how MVC(Model, View, Controller) works in Spring 4.x. In this tutorial you will also find how JDBC works with Spring MVC. We will also see how annotation like @Autowired works in Spring. You will also see how DispatcherServlet, DataSource and ViewResolver are configured in Spring using only Annotation. This example also shows how to integrate Spring 4 with Maven 3.

You may also read https://www.jeejava.com/spring-boot-mvc-with-maven/

For this tutorial we will create maven based web project in Eclipse.

If you already have an idea on how to create a maven project in Eclipse will be great otherwise I will tell you here how to create a maven project in Eclipse.

Prerequisites

The following configurations are required in order to run the application

Eclipse Kepler
JDK 1.8
Tomcat 8
Have maven 3 installed and configured
Spring 4 dependencies in pom.xml

Now we will see the below steps how to create a maven based project in Eclipse Continue reading “Spring MVC and JDBC CRUD with zero XML”

Spring MVC Multiple Files Upload Example

In my previous tutorial I have shown  Spring MVC Single File Upload Example. This tutorial shows an example on how to upload multiple files using Spring MVC 4.x.

For this tutorial we will create maven based web project in Eclipse.

If you already have an idea on how to create a maven project in Eclipse will be great otherwise I will tell you here how to create a maven project in Eclipse.

Prerequisites

The following configurations are required in order to run the application

Eclipse Kepler
JDK 1.8
Tomcat 8
Have maven 3 installed and configured
Spring 4 and Apache commons IO dependencies in pom.xml

Now we will see the below steps how to create a maven based project in Eclipse Continue reading “Spring MVC Multiple Files Upload Example”