I need to use 3 different transaction managers in my webapp. Therefore, I wrote my own annotation according to the Spring link (section 10.5.6.3 Custom shortcut annotations).
One annotation (to use one specific transaction operator) is as follows:
import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.springframework.transaction.annotation.Transactional; @Target({ElementType.METHOD, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @Transactional("customer") public @interface CustomerTX{ }
Everything works great when annotating my level of service using the @CustomerTX annotation. But I have to provide more options for my annotation, such as readonly = true, rollbackFor = and so on. Since you cannot "extend" the annotation (I just need to extend the @Transactional annotation from Spring), why do I need the correct implementation?
java spring annotations transactional
tim.kaufner
source share