Recursively Move a Directory

Jan 09, 2019

This article shows one effective implementation that follows the Visitor Pattern to recursively move a directory using Java NIO library.... Read more

Wrap A Command with Builder Pattern

Dec 19, 2018

This article shows a well-designed way to wrap a command and expose it through API with the classic Builder pattern. In this tutorial, you will learn how to write the Builder pattern, and how to direct standard output stream and standard error stream... Read more

Override Enum Methods with Constant Specific Class Body

Nov 20, 2018

This article shows one advanced technique when using enums - constant specific class body.... Read more

Reload Configurations from Spring Cloud Config

Nov 13, 2018

Spring Cloud Config Server automatically retrieves specified configurations backed on Git based Repository. To ask the affected Spring Cloud Config clients to use the updated configuration, a signal needs to be sent to the client. This article shows ... Read more

Overwriting Spring Security Context through Filter

Oct 30, 2018

This article presents a strategy that overwrites the spring security context in order to allow a user to visit the resources without authenticating the user through the authentication filters. ... Read more

Spring Data MongoDB GridFS 3.4

Oct 17, 2018

This article shows a typical usage of MongoDB GridFS with Spring Data MongoDB. This is for MongoDB java driver v3.4 and Spring Data MongoDB v1.10.x. Note that Spring Data MongoDB v2.X introduces breaking changes with the MongoDB java driver 3.6+. Thi... Read more

Handle Non-encoded Request URL

Oct 14, 2018

Normally we need to encode the request URL from the client before sending a request to the server, but there may be just one time that you really can't enforce the client to encode their request URL and sometimes it contains special characters that w... Read more

Entity Graphs for Lazy Loading

Oct 10, 2018

*Entity Graphs* are templates for persistence query. One common problem it solves is *Lazy Loading*. This article introduces the basics of *Entity Graphs* and how to use *Entity Graphs* with *JPA* and *Spring Data* to solve the *Lazy Loading*.... Read more

Building an Efficient Cache

Sep 26, 2018

To build a cache could be as simple as to just to use a key-value pair kind data structure. It works sufficient most of the time in a single-threaded application. However, when there are many clients access the same cache while the computation being ... Read more

Basic Serialization

Sep 02, 2018

Serialization includes the part that serializes an object to a file and deserializes a file to an object that has the desired same state as it was in. It is typically done by using two high-level classes from the `java.io` package - `ObjectOutputStre... Read more