In this post under Spring Core, I will explain with example how to use “@Lookup” annotation with arguments. In the previous post under Spring Core, I showed the purpose and how to use “@Lookup” annotation without any arguments. Just for recap,1) “@Lookup” annotation is applied on the method level2) It tells Spring to create a…… Continue reading Using @Lookup annotation with arguments
Using defaultExpressions
In this post under MapStruct, I will explain with example the purpose of “defaultExpressions”. Default expressions are the expressions that are executed with the source attribute is null. I have introduced you to expressions in MapStruct in previous posts. Till now we were using expressions without the source attribute. But in case of default expressions…… Continue reading Using defaultExpressions
Using @Lookup annotation without arguments
In this post under Spring Core, I will explain with example the purpose of “@Lookup” annotation used without any arguments. “@Lookup” annotation is applied only on methods. “@Lookup” annotation can be used with or without arguments. In this post I will show how to use “@Lookup” annotation without arguments. In case of “@Lookup” annotation without…… Continue reading Using @Lookup annotation without arguments
ObjectPool getReturnedCount example
In this post under Apache Pool, I will explain with example the purpose of “getReturnedCount” method. This method is mainly used when generating statistics of a particular object pool. This method returns the total number of objects returned back to pool during the lifetime of the pool. So for example, if we have pool running…… Continue reading ObjectPool getReturnedCount example
Using decorator during mapping
In this post under MapStruct, I will show how to use decorator to implement pre and post mapping operations. For our example, we will use the “Student” and “StudentDTO” pojo classes. The class structure is as shown below Student package package26; public class Student { private int id; private String name; private String className; //Removed…… Continue reading Using decorator during mapping
ObjectPool getCreatedCount example
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
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