dimanche 12 avril 2015

Pseudo Scopes in Spring


enter code here


In JSR-346 (contexts and dependency injection), there is a concept of a pseudo scope.

A pseudo-scope is annotated @Dependent and have a dedicated instance of a dependency for the object that needs the dependency.

In the case of normal scope, if several beans need the same dependency, they all can refer to a single instance of the dependency within the scope.

It is mentioned as well, that the singleton scope is kind of pseudo scope... //it has only one instance, so what is the point... don't get it Anyway, what is the counterpart of a pseudo-scope in spring?

I guess, that if two beans need a dependency ant it is resolved to a particular bean instance at run-time, both the beans needing the dependency will get a reference to this one instance (if they are in the same thread)


Aucun commentaire:

Enregistrer un commentaire