openwebbeans-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Struberg <strub...@yahoo.de>
Subject Re: Interceptor enablement per bean archive
Date Sun, 09 Dec 2012 20:54:40 GMT
Hi Harald!

OWB ignores BDA for interceptors, alternatives and decorators by default. You can enable the
BDA behaviour via a flag.
But I suggest to not use this flag ;)

Please think about _real_ applications. The world is already full with oversimplified and
too abstract samples ;)

In a REAL application you do not have this problem! Enabling an interceptor or alternative
will just have not effect on other libraries, because they simply do not use those interceptors.
Otoh think about a MailService from some backend library, a jar you take from another department
in your company. This jar has tons of other functionality which uses the @Inject MailService
ms; Now imagine you like to use an @Alternative SecureMailService. For using this you would
need to change all the jars you get in from somewhere.

In current Glassfish and other EE server installations many big projects I know ended up unpacking
all their dependencies to WEB-INF/classes and merge all beans.xml into WEB-INF/beans.xml manually
:/

BDA enablement is really counter-productive in real world apps.



Btw, funnily @Specializes does NOT have this restriction!

LieGrue,
strub



----- Original Message -----
> From: Harald Wellmann <hwellmann.de@gmail.com>
> To: "user@openwebbeans.apache.org" <user@openwebbeans.apache.org>
> Cc: 
> Sent: Sunday, December 9, 2012 8:11 PM
> Subject: Interceptor enablement per bean archive
> 
> Scenario:
> 
> There are two bean archives sample.jar and test.jar.
> sample.jar contains an interceptor, an interceptor binding annotation and some 
> beans with methods annotated by this annotation.
> 
> test.jar has some test classes verifying that the annotated methods do get 
> intercepted.
> 
> The tests pass when the interceptor is enabled in sample/META-INF/beans.xml and 
> fail as expected when not enabled.
> 
> Problem:
> 
> The tests also pass when the interceptor is enabled in tests/META-INF/beans.xml 
> but not in sample/META-INF/beans.xml.
> 
> According to section 9.4. of the CDI 1.0 spec, I would have expected an 
> interceptors definition in tests.jar to have no effect at all on beans in some 
> other bean archive (sample.jar).
> 
> I'm testing in a plain old Java SE environment. Same problem with OWB 1.1.6 
> and Weld 1.1.9.
> 
> I read the discussion in https://issues.jboss.org/browse/CDI-18 which seems to 
> be related, but it sounds rather open-ended to me.
> 
> My questions:
> 
> 1) Is it true that my tests SHOULD fail by CDI 1.0 if the interceptor is enabled 
> in the wrong archive?
> 
> 2) What is the implemented (or intended) behaviour in OWB, for Java SE and Java 
> EE applications?
> 
> Best regards,
> Harald
> 

Mime
View raw message