Posts

Showing posts from February, 2017

Spring Cache - Part 1 - Introduction

Image
Caching is an extremely important aspect of applications that care about lower latencies. There are a multitude of rules one has to adhere to while setting up a cache, in order to optimize the performance; but not overdo it. We will not get into those details in this post. Our focus would be on what Spring provides to enable caching in your applications.

JSON Property Name Customization in Jackson using PropertyNamingStrategy

Image
Jackson is one of the most popular java libraries for serialization/deserialization of POJOs to/from JSON. By default, Jackson derives the JSON element names from the getter/setter method names of the POJO. e.g. getActorName() is translated to actorName in the resulting JSON.

How to Timeout JDBC Queries

Image
JDBC queries by default do not have any timeout, which means that a query can block the thread for an unlimited amount time; of course, depending upon the DB load and the cost of the query. It is a good practice to timeout these queries if they can take longer than a certain amount of time.

Tarlog - Eclipse Plugin for Windows

Image
Tarlog is a plugin for eclipse that provides some useful features if you are working on a Windows machine. It allows you to Copy Path, Open Shell or Open Explorer on the selected file or folder in the project. It also allows changing the font of the editor through Ctrl++ and Ctrl-- keys.

Overriding Spring Beans with Aliases

Image
The most common approach followed for overriding a spring bean is to define a new bean, with the same id as the original bean, in a separate XML file. During context initialization, Spring would register the last bean found for the id, and use it for all the injections. I dislike this approach for two reasons.