openwebbeans-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <rmannibu...@gmail.com>
Subject Re: Interceptors and @PostConstruct methods
Date Thu, 06 Feb 2014 10:50:56 GMT
seems it works for me:

@CatchMe
@Interceptor
public class Inter {
@PostConstruct
public void post(final InvocationContext ic) {
System.out.println(">>> ok");
System.out.println(">>> ok");
System.out.println(">>> ok");
System.out.println(">>> ok");
}
}


@InterceptorBinding
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface CatchMe {
}


Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau



2014-02-06 Lars-Fredrik Smedberg <itsmeden@gmail.com>:
> Hi Romain
>
> In the Interceptor I tried:
>
> @PostConstruct
> public void interceptPostConstructMethod(InvocationContext ctx) {
>    ...
> }
>
>
> On Thu, Feb 6, 2014 at 11:08 AM, Romain Manni-Bucau <rmannibucau@gmail.com>
> wrote:
>>
>> Hi
>>
>> what's the signature you used for your @PostContruct method?
>> Romain Manni-Bucau
>> Twitter: @rmannibucau
>> Blog: http://rmannibucau.wordpress.com/
>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>> Github: https://github.com/rmannibucau
>>
>>
>>
>> 2014-02-06 Lars-Fredrik Smedberg <itsmeden@gmail.com>:
>> > Hi
>> >
>> > When looking at http://docs.oracle.com/javaee/6/tutorial/doc/gkigq.html
>> > it
>> > looks like I could create an Interceptor with a method annotated
>> > @PostConstruct which would get called when the annotated target class
>> > @PostConstruct  annoted method is called.
>> >
>> > I cannot get this to work, however an Interceptor having a method
>> > annotated
>> > @AroundInvoke works fine when calling business methods in the annotated
>> > target class.
>> >
>> > Can anyone point me in the right direction to get it to work (or maybe
>> > tell
>> > it is not supposed to work as I think it should :))
>> >
>> > Regards
>> > Fredrik
>> >
>> > --
>> > Med vänlig hälsning / Best regards
>> >
>> > Lars-Fredrik Smedberg
>> >
>> > STATEMENT OF CONFIDENTIALITY:
>> > The information contained in this electronic message and any
>> > attachments to this message are intended for the exclusive use of the
>> > address(es) and may contain confidential or privileged information. If
>> > you are not the intended recipient, please notify Lars-Fredrik Smedberg
>> > immediately at itsmeden@gmail.com, and destroy all copies of this
>> > message and any attachments.
>
>
>
>
> --
> Med vänlig hälsning / Best regards
>
> Lars-Fredrik Smedberg
>
> STATEMENT OF CONFIDENTIALITY:
> The information contained in this electronic message and any
> attachments to this message are intended for the exclusive use of the
> address(es) and may contain confidential or privileged information. If
> you are not the intended recipient, please notify Lars-Fredrik Smedberg
> immediately at itsmeden@gmail.com, and destroy all copies of this
> message and any attachments.

Mime
View raw message