Gentlemen

I would like to clarify for myself whether there are clear links between the following pairs of terms in connection with Spring bins:

  • singleton - prototype
  • thread-safe - not-thread-safe
  • stateful - stateless

Is it possible to argue that:

  • prototype == thread-safe
  • singleton! = thread-safe

  • prototype == stateful

  • singleton == stateless

Thanks in advance.

    1 answer 1

    It is impossible. Singleton can be quite thread-safe, and the prototype can do some kind of non-thread-safe things, even though it should be updated in its class. If the code is written well, then it will not be non-thread-safe anywhere else.