Tips && Tricks

Spring Asynchronous Processing

Spring with annotations has made asynchronous processing much more easier to handle. You can make any methods to behave asynchronously just by annotating it with @Async. Read ahead to know more about this.

Spring Test Property Injection without Properties File

Testing Java service classes might get a little tricky if they use application properties which are injected via Spring. Creating separate test-properties file for such tests is expensive if it has only one or two properties in it. In such situations, it could be helpful to use the below described approach.

Java Cache Data Structure

The Google core library for Java called Guava provides lot of ready made features for Java developers. One such feature is the caching Data Structure using CacheBuilder. We should consider using caches when a value is expensive to compute or when it is needed more than once.

Send Mail using Spring Boot

Configuring and sending emails in java has become a lot more easier with the support of Spring Boot. Now you can send emails in your application with very little configuration and development time.

Maven and Spring Boot Profiles

It is often very convinient if we could adjust the spring boot profiles from an external tool like maven. This might come handy when we want to easily activate profiles during the maven build without the need for editing the boot properties file manually.