Posts

Spring MVC - How to handle errors from a controller?

Image
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.

Java - How to find the IP Address of a host in Java ?

In Java, if you are looking to resolve an IP Address from the given hostname, then you can leverage the capabilities provided by InetAddress . It belongs to the "java.net" package and provides various utilities related to resolving addresses and IPs.

Spring - Initializing a Spring Bean

Image
It is often required to run some custom code on initialization of a Spring bean. e.g. to check for mandatory properties or establish initial connections. Spring provides a few constructs to initialize the beans after they are injected with the properties.

Groovy - How to Execute Groovy Scripts in Sublime Text?

Image
This article covers the steps to setup Sublime Text to execute Groovy scripts.

How to Read Files in Groovy?

Image
This article shows various ways of reading a text file in groovy.

How to Create Web Notifications

Image
Web Notifications provide ways for websites to display notifications to users e.g. alerting the user about a business event or success/failure of an asynchronous operation.

Spring - Lookup Method or Method Injection

Image
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.

How to Create Custom Namespaces and Handlers in Spring

Image
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.