maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niranjan Rao <nhr...@gmail.com>
Subject Enforcing annotations
Date Tue, 25 Nov 2014 03:01:59 GMT
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-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message