Introduction File upload example using Spring REST Controller will show you how to upload a file when selected for uploading from any client (browser or any client) and Spring REST service is used as a server side technology for uploading the file. The file may be any type, i.e., such as excel, text, word, pdf…

Posted in File Upload Spring REST

File Upload Example using Spring REST Controller

Introduction Spring EnableEncryptableProperties with Jasypt shows an example how to avoid putting clear text password for database connection’s credentials in properties file. Jasypt means Java simplified encryption. Here I am going to use Spring Boot with Jasypt (Java simplified encryption). Here I am also going to use Spring Data JPA to perform the data layer…

Posted in Spring Boot Spring JPA Spring REST Spring Security

Spring EnableEncryptableProperties with Jasypt

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…

Posted in AJAX Spring Boot Spring REST

Spring Boot MVC AutoComplete using jQuery

Introduction I am going to show you an example on how to build app to send push notifications using Spring’s server sent events API. You might 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…

Posted in Spring Boot Spring REST

Server Sent Events with Spring – Push Notifications

Introduction This tutorial will show you how to use swagger 2 using Spring Boot application for creating RESTful documentation. You generally create and deploy REST services but you do not have an option to let others know in a single place, where REST services are exposed for consumption or what details are there for a…

Posted in Spring Boot Spring REST Swagger

Spring Boot REST API Documentation with Swagger 2

Introduction 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…

Posted in Junit Spring REST

Junit Testing Spring REST Services

Introduction In this tutorial we will see how to build Spring RESTFul WebService CRUD example. Here we will use Spring version 4. We will 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. You may also be…

Posted in Spring REST

Spring RESTful Webservice 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 https://roytuts.com/angularjs-php-rest-crud-example/…

Posted in Angular Spring MVC Spring REST

Spring MVC + Angular CRUD Example

Introduction In this tutorial I will discuss about the asynchronous execution support in Spring using the @Async annotation. There are cases where Spring framework’s @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…

Posted in Spring MVC Spring REST

Spring Asynchronous Execution using @Async

Introduction In this tutorial I will show you an example on @PreAuthorize annotation – hasPermission() example in Spring Security. The most useful annotation @PreAuthorize, which decides whether a method can actually be invoked or not based on user’s role and permission. hasRole() method returns true if the current principal has the specified role and hasPermission()…

Posted in REST Security Spring REST Spring Security

@PreAuthorize annotation – hasPermission example in Spring Security

Introduction In this tutorial I will show you an example on @PreAuthorize annotation – hasRole() example in Spring Security. @PreAuthorize is the most useful annotation that decides whether a method can actually be invoked or not based on user’s role. hasRole() method returns true if the current principal has the specified role. By default if…

Posted in REST Security Spring REST Spring Security

@PreAuthorize annotation – hasRole example in Spring Security

Introduction 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. The reason behind validating input data in Service Layer is, input data from client may not…

Posted in Spring MVC Spring REST

Spring Service Layer Bean Validation