In this post under Apache Pool, I will explain with example the purpose of “getCreatedCount” method. This method is mainly used when generating statistics of a particular object pool. This method returns the total number of objects created during the lifetime of the pool. So for example, if we have pool running for 1 hour…… Continue reading ObjectPool getCreatedCount example
Month: July 2025
Using @Conditional example
In this post under Spring Core, I will show with example the purpose of “@Conditional” annotation. Sometimes we want certain beans to be initialized based on a condition. If those conditions are not met we don’t want to initialize those beans. Say for example, we have two beans “bean1” and “bean2”. We want only “bean1″…… Continue reading Using @Conditional example
Internationalization in Spring
In this post under Spring Core, I will show with example how to achieve Internationalization using Spring framework. Internationalization in Spring is achieved using “MessageSource” interface and its default implementations. Whenever an “ApplicationContext” instance is created, Spring searches for bean definition with name “messageSource”, when found associate it with “ApplicationContext” instance. “ApplicationContext” interface implements “MessageSource”…… Continue reading Internationalization in Spring
ObjectPool getBorrowedCount example
In this post under Apache Pool, I will explain with example the purpose of “getBorrowedCount” method. This method is mainly used when generating statistics of a particular object pool. This method returns the total number of objects borrowed from the pool during the lifetime of the pool. So for example, if we have pool running…… Continue reading ObjectPool getBorrowedCount example
Using source object in expressions
In this post under MapStruct, I will show with example, how to use source object in our expressions. For our example, lets say we have to map “Student” object to “StudentDTO” object. Below are their class structures Student package package25; public class Student { private int id; private String firstName; private String lastName; //Removed the…… Continue reading Using source object in expressions
Appling @Value on constructor parameter
In this post under Spring Core, I will show with example how to apply “@Value” annotation on a constructor parameter. In my previous post under Spring Core, I have showed how to apply “@Value” annotation on class instance variable. Below is the complete main class showing how to apply “@Value” annotation on a constructor parameter…… Continue reading Appling @Value on constructor parameter
IOUtils copyLarge method
In this post under Apache Commons IO, I will show with example the purpose of static method “copyLarge” available in “IOUtils” class. In our previous post under Apache Commons IO, we already covered “copy” method available in “IOUtils” class. The purpose of both the methods is same i.e., copy the contents of one file into…… Continue reading IOUtils copyLarge method
IOUtils writeLines method
In this post under Apache Commons IO, I will show with example the purpose of “writeLines” static method available in “IOUtils” class “writeLines” method takes a list of Objects and writes them to outputstream or writer. For each object to be written, it calls its “toString” method to get the String representation of the object…… Continue reading IOUtils writeLines method