Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does @Service guarantee uniqueness in Spring?

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

like image 422
Jérôme Verstrynge Avatar asked Dec 10 '12 21:12

Jérôme Verstrynge


1 Answers

From the docs

The singleton scope is the default scope in Spring

So there is no need to set this explicitly.

like image 51
Reimeus Avatar answered Sep 22 '22 03:09

Reimeus