I think you will find it easier to add a temporary Spring bean (during
development) that scans your beans/annotations to report what you want:
http://stackoverflow.com/questions/259140/scanning-java-annotations-at-runtime


Cheers,
Paul

On Mon, Nov 24, 2014 at 9:01 PM, Niranjan Rao <nhr...@gmail.com> wrote:

> Since this was not a maven question directly, I tried posting this at
> stackoverflow first at https://stackoverflow.com/
> questions/27068654/how-to-enforce-verify-spring-scope-
> annotation-on-spring-beans. Did not get much traction.
>
> We do use spring and its dependency injection mechanism using annotations
> only. No XML files for spring.  However the trouble starts when developers
> start mixing beans of different scopes - most of the time by accident. Many
> developers forget that beans are singleton in scope by default and end up
> creating beans (or services) that has state. They are happy because if it
> works on their machine but creates interesting mix/match of data when more
> than one user logs in to the application.
>
> Right now, I am thinking of simple solution - enforce that every spring
> component needs to have scope annotation also. Thought behind this is it
> will force developer to think about the scope by explicitly declaring the
> value.
>
> Are there any plugins that can do this? If not, can I extend maven
> enforcer plugin or findbugs in anyway to do this? Open to any other
> suggestions also.
>
> Regards,
>
> Niranjan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>

Reply via email to