Posts

Showing posts from May, 2014

Compile Time Annotation Parsing

Annotation which is being primarily used for metadata purposes in Code needs to be parsed to imply the purpose they are intended for. Annotation Parsing is basically done at runtime with Reflections api. This is the usual approach which we generally folow. Apart from the above mentioned fact annotation parsing can also be done at Compile Time and in this post I am going to throw some light into that. Compile Time annotation Parsing follows the SPI (Service Provider Interface) architecture. To achieve this: I have declared a Custom annotation as follows: import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @Inherited @Retention(RetentionPolicy.SOURCE) public @interface CompileTimeParsing { } The main thing to look aout for in the above code is the Retention Policy, which is Source, which is normally Runtime when we use annotation parsing at runtime with Reflections. Now we define the a

Spring 3 Transaction Fundamentals (Declarative Annotation Based)

In this post I am going to provide some insight regarding Spring Transaction (Annotation bases: "@Transaction") The Annotation based Spring Transaction can be configured in two modes: 1)proxy (default) 2)aspectj and this can be configured through mode attribute of Here I am going to discuss primarily regarding the proxy mode only. There are two types of proxy used in Spring configuration: 1) Jdk dynamic Proxy. 2) Cglib Proxy. Jdk dynamic Proxy: It is interface based proxy, and it is default configured as "proxy-target-class" attribute of is false (by default). The Proxy is created by implementing the interface specified and then delegating the calls to the target object. Cglib Proxy: It is class based proxy. The proxy is created by subclassing the target class. It is used when "proxy-target-class" attribute of is set to true. Each one has its own usage criteria Like 1) f