Action beans should/must be "prototype" scope ?
Tom Zeller
tzeller at dragonacea.biz
Fri Nov 6 12:12:47 EST 2015
Old thread, but it came up on the call today. I had a saved draft I
never sent, which is appended below.
On Thu, Feb 13, 2014 at 4:20 PM, Tom Zeller <tzeller at dragonacea.biz> wrote:
>>>If so: Perhaps we could still make use of a BeanFactoryPostProcessor to
>>>implement the @Scope annotation in a different way than
>>>component-scanning, by using it to directly set the scope on the bean
>>>definition. I haven't tried this, so don't know if works.
>>
>> Yeah, my preferred model would be: checking for an annotation (Springs or
>> ours) declared on our base class in a bean factory post processor, with a
>> flag at runtime being a backup choice.
>
> I think we should create and use our own @Prototype annotation in
> order to annotate actions in OpenSAML, mostly because the
> BeanPostProcessor which wraps OpenSAML actions runs after
> BeanFactoryPostProcessors.
>
> I kind of think we should annotate each action with @Prototype in
> symmetry with defining 'scope="prototype"' for every action bean
> definition. I think we should annotate both the OpenSAML and IdP
> AbstractProfileAction with @Prototype as well as a default, which is
> redundant, but I am okay with the redundancy because of how important
> this seems to be.
Is it okay to use annotations for something other than documentation
in non-test code ?
Given a bean definition lacking scope="prototype" whose class or
superclass is somehow annotated as "prototype", should we (a) change
the scope of the bean definition in a post processor or (b) just log
an error or (c) throw an exception ?
So far annotations have been for documentation. Wondering if we should
deviate from that.
More information about the dev
mailing list