![Mastering Spring 5.0](https://wfqqreader-1252317822.image.myqcloud.com/cover/64/36701064/b_36701064.jpg)
上QQ阅读APP看书,第一时间看更新
Spring bean scopes
Spring beans can be created with multiple scopes. The default scope is a singleton.
Since there is only one instance of a singleton bean, it cannot contain any data that is specific to a request.
The scope can be provided with the @Scope annotation on any spring bean:
@Service
@Scope("singleton")
public class BusinessServiceImpl implements BusinessService
The following table shows the different types of scopes available for beans:
![](https://epubservercos.yuewen.com/9A5966/19470407701638406/epubprivate/OEBPS/Images/5.jpg?sign=1739308623-P3aMCpBQu1Cnmm5IUf41i32n73rQF7iG-0-587a50dc45a59641f0079560ab8a7c37)