Does @Service provide uniqueness in Spring?

Assuming the class is annotated with @Service , does Spring guarantee a unique instance of the class for injection? Or should I put @Scope("singleton") in every service?

+6
source share
2 answers

From docs

Singleton scope is the default scope in Spring

Therefore, there is no need to set this explicitly.

+10
source

Here is the discussion I found on CodeRanch:

http://www.coderanch.com/t/586038/Spring/Spring-treat-Service-Singleton

And the answer is from another Stackoverflow post:

fooobar.com/questions/317310 / ...

+1
source

All Articles