How to use @RestControllerAdvice for handling Exception with RestfulApi – New Features of Spring Framework 4.3

We had discussed about @ExceptionHandler, @ResponseStatus, @ControllerAdvice in How to use Spring Exception Handler for SpringMVC: @ExceptionHandler, @ResponseStatus, @ControllerAdvice. In the tutorial, JavaSampleApproach will guide to how to use a new feature of Spring Framework 4.3: @RestControllerAdvice.

[Continue reading…] “How to use @RestControllerAdvice for handling Exception with RestfulApi – New Features of Spring Framework 4.3”

How to use Spring Exception Handler for SpringMVC: @ExceptionHandler, @ResponseStatus, @ControllerAdvice

Spring provides a cross-cutting concern solution for handling Java Excepion. So in the tutorial, JavaSampleApproach will guide how to use Spring Exception with: @ResponseStatus, @ExceptionHandler & @ControllerAdvice.
Related Articles:
How to handle Java Exception
How to use @RestControllerAdvice – New Features of Spring Framework 4.3

[Continue reading…] “How to use Spring Exception Handler for SpringMVC: @ExceptionHandler, @ResponseStatus, @ControllerAdvice”

How to create paging and sorting results with Spring JPA and PostgreSQL | Spring Boot

Spring Data with Spring JPA supports the ways to write interface for repositories and custom finder methods. Pagination is so important in case we have many data records to show.

In this tutorial, we’re gonna look at the way to make paging and sorting results with Spring JPA and PostgreSQL using Spring Boot.

Related articles:
How to use Spring JPA MySQL | Spring Boot
How to use Spring JPA with PostgreSQL | Spring Boot
@DataJPATest with Spring Boot

[Continue reading…] “How to create paging and sorting results with Spring JPA and PostgreSQL | Spring Boot”

How to handle Java Exception

We had introduced JavaException in 2 articles: Understand Java Exception & The effect to Java Program (Single & Multi Thread) & How to work with Java Custom Exception. In the tutorial, JavaSampleApproach will guide how to handle Java Exception.
Related post:
How to use Spring Exception Handler for SpringMVC: @ExceptionHandler, @ResponseStatus, @ControllerAdvice

[Continue reading…] “How to handle Java Exception”

How to change logging level with the MVC endpoint – new Actuator Loggers Endpoint | Spring Boot

Spring Boot 1.5.1 provides some new features. Among them, we have a new actuator loggers endpoint, which helps us to view and change logging level of application with the MVC endpoint.

This tutorial shows you the way to do this with http GET/POST request.

[Continue reading…] “How to change logging level with the MVC endpoint – new Actuator Loggers Endpoint | Spring Boot”

How to work with Java Custom Exception

Java Exception has 2 types: CheckedException & UnCheckedException as discussion in Understand Java Exception & The effect to Java Program (Single & Multi Thread). The Java Custom Exception tutorial will introduce how to customize them by example.
Related Article:
How to handle Java Exception

[Continue reading…] “How to work with Java Custom Exception”

How to perform Form Validation with Spring Boot

We have ever known that JavaScript can validate a Form on Client side, and this tutorial helps you to perform Form Validation on Server side.

Related article: How to create Custom Validation in Spring

[Continue reading…] “How to perform Form Validation with Spring Boot”

Understand Java Exception & The effect to Java Program (Single & Multi Thread)

In the tutorial, JavaSampleApproach will introduce Java Exception and its effect to program’s execution in Single & Multi Thread Program.
Related post:
Java 7 – try-with-resources Statement
How to handle Java Exception

[Continue reading…] “Understand Java Exception & The effect to Java Program (Single & Multi Thread)”

How to start with JSP page and static resource in Spring Boot

In Java Web Application Development, JSP page and static resource (css file, javascript file) are two of the most important thing to start. This tutorial shows you how to embed them into a Spring Boot application.

[Continue reading…] “How to start with JSP page and static resource in Spring Boot”

How to use Spring Integration Http Outbound Gateway for Polling a http end point with GET method

Spring Integration provides Http Outbound Components for polling a Http Endpoints with: Http Outbound Gateway & Http Outbound Adapter.
Http Outbound adapter: just send requests to an http endpoint.
– But Http Outbound gateway: send requests to an http endpoint then return responses.
In the tutorial, JavaSampleApproach will guide you how to poll a http end point with Get request by Http Outbound Gateway.

Related Posts:
1. How to use Spring Integration Http Inbound with Spring Boot
2. How to start Spring Integration with Spring Boot

[Continue reading…] “How to use Spring Integration Http Outbound Gateway for Polling a http end point with GET method”

How to define template for multipage with Apache Tiles in Spring Boot

In the previous post, we have started with Apache Tiles. We know the way to define page fragments (each fragment as a tile) and combine them into a larger page (as a root with many tiles).

This tutorial introduces a way to define template for multipage with Apache Tiles in Spring Boot.

[Continue reading…] “How to define template for multipage with Apache Tiles in Spring Boot”

How to start with Apache Tiles in Spring Boot

Apache Tiles allows us to define page fragments (each fragment as a tile) which can be combined into a larger page (as a root with many tiles). They help to reduce duplication of common content, so that we can make a series of reusable templates more easier.

This tutorial shows you how to start with Apache Tiles in Spring Boot.

[Continue reading…] “How to start with Apache Tiles in Spring Boot”

How to use Spring Security JDBC Authentication with MySQL & Spring Boot

In the tutorial, JavaSampleApproach uses MySQL & Spring Boot to guide you how to develop a Spring Security JDBC for Authentication.

Related Articles:
How to use Spring Security JDBC Authentication with PostgreSQL & Spring Boot
Spring Security – Config Security for Web MVC by Spring Boot
Spring Security – Customize Login Handler
Spring Security Customize Logout Handler
Spring Security – Customize Authentication Provider

[Continue reading…] “How to use Spring Security JDBC Authentication with MySQL & Spring Boot”

How to write Text File in Java by BufferedWriter

Java provides a BufferedWriter for writting content to File with high performance when performing with large number of write action. Because BufferedWriter decreases I/O interaction by using internal buffer to write data into File.
Related posts:
1. Java Read Text File by BufferedReader, Java 7,Java 8
2. How to delete non-empty Folder in Java

[Continue reading…] “How to write Text File in Java by BufferedWriter”

Java recursion – Towers Of Hanoi

Earlier in the tutorial Solution for find the N-th Fibonacci number, we have already known the methods that can be easily implemented with recursion and iteration. Today we will see a solution which demonstrates the power of recursion, and the iterative solution may not be a clearer method: Towers of Hanoi.

[Continue reading…] “Java recursion – Towers Of Hanoi”

How to use Spring Security JDBC Authentication with PostgreSQL & Spring Boot

In this tutorial, JavaSampleApproach uses PostgreSQL & Spring Boot to develop a Spring Security JDBC for Authentication.

Related Articles:
How to use Spring Security JDBC Authentication with MySQL & Spring Boot
Spring Security – Config Security for Web MVC by Spring Boot
Spring Security – Customize Login Handler
Spring Security Customize Logout Handler
Spring Security – Customize Authentication Provider

[Continue reading…] “How to use Spring Security JDBC Authentication with PostgreSQL & Spring Boot”

How to execute asynchronous query with Spring JPA and PostgreSQL | Spring Boot

In tradition approach, implementing Data Access Layer makes lots of boilerplate code. Spring Data provides us Spring JPA which supports the ways to write interface for repositories and custom finder methods. The implementation will be done automatically by Spring Framework.

The tutorial shows you how to execute asynchronous query with Spring JPA and PostgreSQL using Spring Boot.

Related articles:
Java 8 Streams
How to use Spring JPA MySQL | Spring Boot
How to use Spring JPA with PostgreSQL | Spring Boot
How to get streaming results with Spring JPA, Java 8 Stream and PostgreSQL | Spring Boot
@DataJPATest with Spring Boot

[Continue reading…] “How to execute asynchronous query with Spring JPA and PostgreSQL | Spring Boot”

Java Regular Expression to mask information from a Text

This tutorial shows you how to mask information from a Text using Regular expression.

Related articles:
Java Regular Expression Overview – Syntax
Java Regular Expression to extract data from a Text

[Continue reading…] “Java Regular Expression to mask information from a Text”

How to get streaming results with Spring JPA, Java 8 Stream and PostgreSQL | Spring Boot

In tradition approach, implementing Data Access Layer makes lots of boilerplate code. Spring Data provides us Spring JPA which supports the ways to write interface for repositories and custom finder methods. The implementation will be done automatically by Spring Framework.

The tutorial shows you how to make streaming results with Spring JPA, Java 8 Stream and PostgreSQL using Spring Boot.

Related articles:
Java 8 Streams
How to use Spring JPA MySQL | Spring Boot
How to use Spring JPA with PostgreSQL | Spring Boot
@DataJPATest with Spring Boot

[Continue reading…] “How to get streaming results with Spring JPA, Java 8 Stream and PostgreSQL | Spring Boot”

How to configure Spring Batch Step for restart

In How to use Spring Batch Restartable Function, we had discussed about how to restart a Job. Today, JavaSampleApproach will guide you how to use additional configuration for step in case restart a Batch Job.

Related articles:
1. How to use Spring Batch Restartable Function
2. Spring Batch XML Config by Spring Boot

[Continue reading…] “How to configure Spring Batch Step for restart”