== Why is this an issue?

Spring ``++@Controller++``s, ``++@Service++``s, and ``++@Repository++``s have ``++singleton++`` scope by default, meaning only one instance of the class is ever instantiated in the application. Defining any other scope for one of these class types will result in needless churn as new instances are created and destroyed. In a busy web application, this could cause a significant amount of needless additional load on the server.


This rule raises an issue when the ``++@Scope++`` annotation is applied to a ``++@Controller++``, ``++@Service++``, or ``++@Repository++`` with any value but "singleton". ``++@Scope("singleton")++`` is redundant, but ignored.


=== Noncompliant code example

[source,java]
----
@Scope("prototype")  // Noncompliant
@Controller
public class HelloWorld { 
----


=== Compliant solution

[source,java]
----
@Controller
public class HelloWorld { 
----


ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

=== Message

Remove this "@Scope" annotation.


=== Highlighting

``++@Scope(...)++``


'''
== Comments And Links
(visible only on this page)

=== on 8 Mar 2017, 13:49:05 Alexandre Gigleux wrote:
\[~ann.campbell.2] : I have a doubt about Test Sources scope. Do we have a documentation explaining @Controller for example can be set a on test file ?

=== on 8 Mar 2017, 14:02:18 Ann Campbell wrote:
Thx, [~alexandre.gigleux]. I've removed Test Sources from the Scope.

endif::env-github,rspecator-view[]
