January 28, 2019

Spring MVC - How to handle errors from a controller?
In a web application, it is very important to handle errors. Proper error handling would protect the application from several vulnerabilities, including Security Misconfiguration . In this post, you will see how you can handle exceptions that arise out of a Spring MVC based application. Read More
by
Phee Jay
September 02, 2017

Spring - Initializing a Spring Bean
In Spring, it's often necessary to run custom code during a bean's initialization—for example, to validate mandatory properties or establish initial connections. Spring offers several mechanisms to initialize beans after they’ve been injected with their properties. Read More
by
Phee Jay
July 12, 2017

Spring - Lookup Method or Method Injection
Most common injection mechanisms used in Spring are Constructor and Property injections. In both the mechanisms, the injection happens only once during the initialization of the Bean. They also require a concrete method defined, e.g., a constructor method for constructor injections and a setter method for property injection. Read More
by
Phee Jay
April 28, 2017

Spring - How to Create Custom Namespaces and Handlers in Spring
Custom namespaces in spring are a way to replace the complex bean definitions with a more user-friendly configuration. Spring itself provides several namespaces out of the box. e.g. Read More
by
Phee Jay
April 13, 2017

Spring - Localization with Spring
Localization enables applications to cater to users of different locations and languages. Spring, as usual, has support for this aspect as well. Before jumping into what Spring has to offer, let's explore what we get from Java itself. Read More
by
Phee Jay
March 29, 2017

Spring Boot - How to Create a Deployable War
Spring boot , by default, enables you to create standalone applications through simple, minimal configurations. And due to its self-contained nature, it naturally enables building microservices. Spring starters are poms (if using maven) that Read More
by
Phee Jay
March 09, 2017

Spring Cache - Part 5 - CacheEvict
In the Spring Cache series so far ( Part1 , Part2 , Part3 , Part4 ), we have seen examples where the data is getting added to the cache through the use of @Cacheable and @CachePut . But, what about removing data from cache? Consider a call to delete the record from Service or DB, in which case, we would also want to delete that record from the cache. Read More
by
Phee Jay
March 02, 2017

Spring Cache - Part 4 - CachePut
There are scenarios, unlike retrievals, where you do not want to skip the execution of the method e.g. insert/update of a record. Such methods should not be marked as Cacheable. But, you might still want to cache the result of these methods, in order to avoid unnecessary retrievals in future calls. Read More
by
Phee Jay
March 01, 2017

Spring Cache - Part 3 - Conditional Cache
In this part of the tutorial, we will see how data can be cached conditionally. (If you haven't checked the previous parts, please visit Part 1 and Part 2 . They contain sample code that the examples below refer) Read More
by
Phee Jay
February 25, 2017

Spring Cache - Part 2 - Cache Keys
In part 1 of the post, we looked at how data can be cached through simple configuration. In this part, we are going to explore the cache keys. Read More
by
Phee Jay
February 23, 2017

Spring Cache - Part 1 - Introduction
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. Read More
by
Phee Jay
February 15, 2017

Java - How to Timeout JDBC Queries
Learn how to set timeouts for JDBC queries to prevent indefinite blocking. This guide covers configuring timeouts on individual statements, applying global timeouts at the driver level, and setting timeouts using Spring's JdbcTemplate. Read More
by
Phee Jay
February 09, 2017

Spring - Overriding Spring Beans with Aliases
This blog post discusses how to override Spring beans using aliases and the benefits of managing dependencies in Spring applications. Read More
by
Phee Jay
June 26, 2015

Spring MVC - ETags and Browser Cache
The blog post explains how ETags work to enhance browser caching efficiency, including their benefits and implementation in web development. Read More
by
Phee Jay
October 18, 2010

Spring MVC - What Is a SessionAttributeStore? When to Use It?
The blog post explains how to customize the storage of session attributes in Spring MVC by implementing a custom SessionAttributeStore. This approach addresses issues that arise when multiple forms use the same command object name, ensuring that each form's data is stored uniquely in the session. Read More
by
Phee Jay
October 18, 2010

Spring MVC - mvc:annotation-driven - What does it do?
Explains how mvc:annotation-driven in Spring MVC simplifies setup by auto-registering handler mappings, adapters, and message converters to enable annotation-based controllers. Read More
by
Phee Jay