In Part 1, we discussed the fundamentals of annotations in Java and Kotlin, including an overview of what annotations are, the various types of built-in annotations like @Override, @Deprecated, etc., and how they simplify common programming tasks. We also explored the basic structure of annotations, how to define them, and the importance...
Introduction to Annotations and Their Types Before we dive into the details, let me give you a quick overview of what we’ll cover in this blog. First, we’ll introduce annotations and highlight their importance in modern development. After that, we’ll explore the built-in annotations available in both Java and Kotlin. Once we’ve...
TestNG is a Java Framework to set up the execution flow of the code and for reporting purpose. Annotations used in TestNG: Annotation Description @BeforeSuite BeforeSuite annotation method runs only once before all tests from the suite. @AfterSuite AfterSuite annotation method runs only once after all tests from the...
Starting a YouTube channel is easy but keeping it up and running is somewhat tipsy. You struggle to get enough views and subscribers in the beginning and it doesn't matter how good your content is, you rank low. This is because you still have to optimize your videos with proper tags and long but relevant description in...
We use logging in our application to report and persist error and warning messages as well as info messages (e.g. runtime statistics) so that the messages can later be retrieved and analyzed. Initially we were getting an instance of Logger from LoggerFactory and uses it in our class for logging information, errors, exceptions, warnings...
@Canonical: It's very useful annotation. It provides the combination of features of @ToString (default implementation of toString() method based upon the fields in the class), @EqualsAndHashCode(default implementation of equals() and hashCode() method of the class based upon the fields in the class) and @TupleConstructor (provides the...
In my previous blog, i have mentioned how to integrate spring cache plugin in grails. In this blog we will see how we can use different attributes of cache. Different attributes of cache :- maxElementsInMemory- How many elements you can store in cache overflowToDisk-The attribute overflowToDisk is true, meaning that whenever the...
In one of my recent project, i want to cache method output. For implementing method level cache, i have used spring cache. For implement Spring cache, we can use grails cache plugin. It's very easy to integrate cache plugin with grails. 1. Add following plugin dependency in BuildConfig.groovy. [groovy]compile...
Many of Grails plugin like searchable and console can prove to be really dangerous if access to their URLs is not blocked. After adding searchable plugin to my project, I realized that access to its controllers was not defined and was open for all. Now this was a major security concern. There are many ways of restricting access like...
Recently I worked on a project where I used spring security plugin. Its a very wonderful plugin for making your application secured from unauthorized users. It gives you a simple annotation @Secured to add security to your action and controller. Thats the first time I got to know the real use case of annotation. So I started reading about...
Hi All, Here is how you can implement a new transaction in an already executing transaction in Grails which uses nothing but Spring framework's Transaction mechanism as an underlying implementation. Spring provides @Transactional annotations to provide declarative transactions. We can use the same in our Grails project to achieve the...