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
Middle masking of simple text
In this post under DataMask, I will show with example how to middle mask a simple text. Middle masking of a text means masking the middle portion of text leaving the side portion of text intact. So if the text is “insomnia” and I want to leave first 2 characters and last 3 characters intact…… Continue reading Middle masking of simple text
Default cache key in Spring Caching
In this post under Spring Caching, I will explain with example what default cache key are used when storing data in the cache and you don’t specify your own cache key. Spring Caching out of the box determines the cache key using the method parameters. If a method has no parameters, the key will be…… Continue reading Default cache key in Spring Caching