02 Aug

Junit Testing Spring REST Services

In this tutorial we will see how to write Junit test cases on Spring REST services. Before continue to reading this tutorial please read first Spring RESTful Webservice CRUD Example

We have total four operations on this REST example. If you want you may add more operation such as find all products and apply Junit on it.

Read More

29 Jul

Spring RESTful Webservice CRUD Example

In this tutorial we show you how to build a RESTFul Web Service using Spring 4. We create a controller that will manage CRUD operations such as Create, Read, Update and Delete using the correct HTTP request methods POST, GET, PUT and DELETE respectively. Read More

10 Jun

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/

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

Read More

09 Jun

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.

Read More

03 May

Spring Service Layer Bean Validation

In my previous tutorial I have shown how to validate input data coming from client or end user to Spring REST Controller. Now in this tutorial I will show you how to validate data in Spring Service Layer.

Read More

04 Apr

Validate input data in REST service

In this tutorial I will show you how you can validate your input data while working with REST service.


Please go through the tutorial Documenting Spring REST API with Swagger 2

Read More

13 Mar

Documenting Spring REST API with Swagger 2

When creating a REST API, good documentation is instrumental.

But developers do not have any option using JSR-339 to generate any documentation on all these APIs so other developers could quickly understand how to use them. For sure, it would be just awesome to generate verbose and easy to follow documentation from source code, and but the help is coming in a form of Swagger.

Essentially, Swagger does a simple but very powerful thing: with a bit of additional annotations it generates the REST API descriptions such as HTTP methods, path / query / form parameters, responses, HTTP error codes etc) and even provides a simple web UI to play with REST calls to your APIs. Read More