[weld-dev] Passivating Capabilities check.
Pete Muir
pmuir at redhat.com
Tue Feb 16 07:20:04 EST 2010
Yes, I think static injection is really the correct answer here.
I think this is on the cards for the next release of the spec?
On 16 Feb 2010, at 12:19, Mark Struberg wrote:
>> I think you must use a proxy.
>
> But 'you' means the programmer of the application has to do this manually and not the container, isn't?
>
> Supporting static injection would really be cool in this case!
> Or supporting re-injection after re-activation (would be more difficult I guess).
>
> LieGrue,
> strub
>
>
> --- Pete Muir <pmuir at redhat.com> schrieb am Di, 16.2.2010:
>
>> Von: Pete Muir <pmuir at redhat.com>
>> Betreff: Re: [weld-dev] Passivating Capabilities check.
>> An: "Mark Struberg" <struberg at yahoo.de>
>> CC: weld-dev at lists.jboss.org
>> Datum: Dienstag, 16. Februar, 2010 12:40 Uhr
>>
>> On 16 Feb 2010, at 10:11, Mark Struberg wrote:
>>
>>> Hi!
>>>
>>> I'm just curious how Weld manages to inject a Logger
>> into a @SessionScoped (passivating!) bean.
>>>
>>> In your example in 1.3.5 you wrote:
>>>
>>>> class Loggers {
>>>> @Produces Logger
>> getLogger(InjectionPoint injectionPoint) {
>>>> return
>> Logger.getLogger(injectionPoint.getMember().getDeclaringClass().getSimpleName()
>> );
>>>> }
>>>> }
>>>
>>> and
>>>> @SessionScoped
>>>> public class Permissions implements Serializable
>> {
>>>> @Inject Logger log;
>>>> ...
>>>
>>> but the Logger I know are actually not Serializable
>> themselfs and since it is @Dependent scoped, we also don't
>> use a proxy for it.
>>
>> I think you must use a proxy.
>>
>>>
>>> I'd expected a DeploymentException thrown at startup
>> in this case, but Weld actually seems to only checks
>> passivation stuff for NormalBeans. Anyway, once the session
>> get's passivated, you'll see a fine
>> NotSerializableException.
>>
>> Well, the passivation capability is checked (of
>> Permissions), which includes checking whether the producer
>> method is passivation capable (it is, even though Logger
>> isn't serializable, it also isn't final, so you might return
>> a serializable subclass).
>>
>> I would however expect Weld to throw an
>> IllegalProductException - I wrote this test which shows it
>> does :-)
>>
>> http://fisheye.jboss.org/browse/weld/core/trunk/tests/src/test/java/org/jboss/weld/tests/serialization/SerializationTest.java?r=5841#l45
>
> __________________________________________________
> Do You Yahoo!?
> Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails.
> http://mail.yahoo.com
More information about the weld-dev
mailing list