deltaspike-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Struberg <strub...@yahoo.de>
Subject Re: CDI Extension AnnotatedTypeBuilder
Date Sun, 12 May 2013 14:43:49 GMT
Hi Thomas!

Did you also add the <interceptors> section to your beans.xml?



LieGrue,
strub






>________________________________
> From: Thomas Herzog <t.herzog@curecomp.com>
>To: deltaspike-users@incubator.apache.org 
>Sent: Sunday, 12 May 2013, 16:33
>Subject: CDI Extension AnnotatedTypeBuilder
> 
>
>
>Hello guys
> 
>I want to add a @Transactional annotation which has an interceptor binding to our services
within our JUnit test (Deltaspike openEjb), so that the interceptor will take place when a
service method get invoked.
>The problem is that I can add the annotation to our EjbService annotation (Stereotype)
but the interceptor does not take place when a service method gets invoked.
>Do I miss something or is this not possible??
> 
>    publicvoidhandleEjbServiceannotation(@ObservesProcessAnnotatedType<EjbService>
annotatedType) {
>        AnnotatedTypeBuilder<EjbService> builder = newAnnotatedTypeBuilder<EjbService>();
>        builder.readFromType(annotatedType.getAnnotatedType().getJavaClass());
>        builder.addToClass(newTransactionalLiteral());
>        annotatedType.setAnnotatedType(builder.create());
>    }
> 
>publicclassTransactionalLiteral extendsAnnotationLiteral<Transactional> {
> 
>    privatestaticfinallongserialVersionUID= -5729507529445029857L;
> 
>}
> 
>@Stereotype
>@InterceptorBinding
>@Inherited
>@TransactionAware
>@Target({
>        TYPE,
>        METHOD})
>@Retention(RUNTIME)
>@Documented
>public@interfaceTransactional{
> 
>}
>                       
>@Inherited
>@TransactionManagement(TransactionManagementType.CONTAINER)
>@TransactionAttribute(TransactionAttributeType.REQUIRED)
>@TransactionAware
>@Stereotype
>@Logging
>@ExceptionWrapping({
>        @ExceptionWrap(
>                wrapper = ConcurrentEntityUpdateException.class,
>                sources = OptimisticLockException.class),
>        @ExceptionWrap(
>                wrapper = CoreException.class) })
>@Retention(RetentionPolicy.RUNTIME)
>@Target(ElementType.TYPE)
>public@interfaceEjbService{
>}
> 
>When I try to add the annotation on the supertype of our service the interceptor does
not take place either.
> 
>Thanks in advance.
> 
>Mit freundlichen Grüßen
> 
>Thomas Herzog
>Softwareentwicklung
> 
>curecomp Software Services GmbH
>Hafenstrasse 47-51
>4020 Linz
> 
>web: www.curecomp.com
>e-Mail: t.herzog@curecomp.com
>tel: +43 (0)732 9015-5563
>mobile: +43 (0)664 8867 9829
> 
> 
> 
>
>

Mime
View raw message