Stateless implies that a bean is thread safe. This is because the bean does not use state-dependent code. This means that running any of its methods will not affect the future actions of these methods.
An example of a stateless class is a class that does addition and subtraction. All necessary parameters are passed to the method. Performing addition or subtraction does not change the way these methods work on subsequent calls. This means you donβt have to worry about concurrency with the class.
Singleton is commonly used for a class that is very expensive to create, such as connecting to a database. You do not want each class to create a new database connection each time they need to use the database, so you run it once when the program starts. Single unity does not necessarily mean that the class is thread safe (although this is absolutely necessary).
So idle means that the class is thread safe.
Singleton refers to the fact that a class is created only once. While this largely implies that the class is (AND IT MUST BE) thread safe, it does not directly imply it, as stateless does.
source share