In this post under Java language, I will introduce you to new feature added to Java called “Instance Main Method”. This feature was added in Java version 25. Pre Java 25, if we have to write class with “main” method, we used to mark it as public and static as shown below. You also need…… Continue reading Instance Main method example
Conditional caching using SpEL
In this post under Spring Caching, I will show with example how to enable conditional caching using SpEL. In previous posts I showed you how to use “@Cacheable” annotation. In that annotation itself there is an attribute that we can use to enable conditional caching. That attribute name is “condition” and it takes as SpEL…… Continue reading Conditional caching using SpEL
Creating custom cache key from target object properties using SpEL
In this post under Spring Caching, I will show with example how to create custom cache key using annotated method’s target object properties in SpEL. For our example, we will use the below “Calculator” class as shown below Calculator package caching.package8; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Component; @Component public class Calculator { private int start, end; @Cacheable(cacheNames…… Continue reading Creating custom cache key from target object properties using SpEL
Middle masking of delimited text with configured delimiter
In this post under DataMask, I will show with example how to do middle masking of a simple delimited text excluding masking of delimiter. So if the text is “1111-2222-3333-4444”, the output should be “111*-****-**33-4444” As you can see from the output the numbers are masked in the middle excluding delimiters. Below is the complete…… Continue reading Middle masking of delimited text with configured delimiter
Creating custom cache key from method object properties using SpEL
In this post under Spring Caching, I will show with example how to create custom cache key using annotated method’s properties in SpEL. For our example, we will use the below “Calculator” class as shown below Calculator package caching.package7; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Component; @Component public class Calculator { @Cacheable(cacheNames = "addNumbersWithParam_region", key = "#root.method.hashCode() +…… Continue reading Creating custom cache key from method object properties using SpEL
Side masking of delimited text with configured delimiter
In this post under DataMask, I will show with example how to do side masking of a simple delimited text excluding masking of delimiter. So if the text is “1111-2222-3333-4444”, the output should be “***1-2222-33**-***” As you can see from the output the numbers are masked from the sides excluding delimiters. Below is the complete…… Continue reading Side masking of delimited text with configured delimiter
Full masking of delimited text without configuring delimiter
In this post under DataMask, I will show with example how to do full masking of a simple delimited text including masking of delimiter. So if the text is “1111-2222-3333-4444”, the output should be “*******************” As you can see from the output the numbers and delimiter “-” are also masked. Below is the complete main…… Continue reading Full masking of delimited text without configuring delimiter
Creating custom cache key from method name using SpEL
In this post under Spring Caching, I will show with example how to create custom cache key from method name using SpEL. In SpEL, to access SpEL context object we will use “#root” variable. This SpEL context object will have below information reference to target method that is annotated with @Cacheable, @CachePut, or @CacheEvict reference…… Continue reading Creating custom cache key from method name using SpEL
Creating custom cache key from method arguments using SpEL
In this post under Spring Caching, I will show with example how to create custom cache key from method arguments in SpEL. In SpEL, to access SpEL context object we will use “#root” variable. This SpEL context object will have below information reference to target method that is annotated with @Cacheable, @CachePut, or @CacheEvict reference…… Continue reading Creating custom cache key from method arguments using SpEL
Full masking of delimited text with configured delimiter
In this post under DataMask, I will show with example how to do full masking a simple delimited text excluding masking of delimiter. So if the text is “1111-2222-3333-4444”, the output should be “—” As you can see from the output the numbers are masked but delimiter “-” is not masked. Below is the complete…… Continue reading Full masking of delimited text with configured delimiter