[ 
https://issues.apache.org/jira/browse/ARIES-1464?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15038234#comment-15038234
 ] 

Sam Wright commented on ARIES-1464:
-----------------------------------

At thought - this can look a little confusing in practise, e.g.:
{code}
/** This is a singleton prototype bean?? */
@Singleton @Scope("prototype") class ProtoBean {}
{code}

An alternative solution:

The JSR-330 spec says that a class can be defined as a prototype-scoped bean by 
applying only the @Named annotation, and that to give the bean a 
singleton-scope the @Singleton annotation should then be applied (either with 
or replacing @Named), e.g.

{code}
@Singleton class AutonamedSingleton {}
@Singleton @Named("foo") class NamedSingleton {}
@Named AutonamedPrototype {}
@Named("bar") NamedPrototype {}
{code}

We could implement this quite easily, by adding Named.class to the list of 
annotations in FilteredClassFinder.findClasses, then setting Bean.isSingleton 
to true iff the class has the @Singleton annotation. This would be 
backwards-compatible with annotations written before such a change.

I'd be happy to implement this if you think it's a good idea.

All the best,
Sam

> Improve blueprint-maven-plugin: add @Scope support
> --------------------------------------------------
>
>                 Key: ARIES-1464
>                 URL: https://issues.apache.org/jira/browse/ARIES-1464
>             Project: Aries
>          Issue Type: Improvement
>          Components: Blueprint
>            Reporter: Sam Wright
>            Assignee: Christian Schneider
>
> I propose adding support for configuring bean scope using 
> blueprint-maven-plugin, e.g. annotating a class with `@Scope("prototype")` 
> will add `scope = "prototype"` to the bean's xml element.
> [[email protected]] is probably the person to review this.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to