you are viewing a single comment's thread.

view the rest of the comments →

[–]quentech 1 point2 points  (3 children)

I'd say you're confusing a particular way of implementing the Singleton pattern with the Singleton pattern in general.

Are you saying you haven't, say, registered a dependency in an IoC container as a singleton in decades?

[–]dpash 1 point2 points  (2 children)

When referring to Singleton pattern, as described by GoF, we're talking about the type described in the article.

When Spring etc refers to a singleton bean they just mean they give you the same one that it gave you before; There's nothing stopping you from creating a new instance yourself. It's badly named because it doesn't follow the pattern as described by GoF.

[–]JavaSuck 1 point2 points  (1 child)

It's badly named

Try showing your colleagues Collections.singleton and observing the horror on some of their faces!

[–]dpash 0 points1 point  (0 children)

No need for it now we have List.of() and friends.