Since there are already: @ApplicationScope, @RequestScope and @SessionScope (here). In order to be consistent, I guess it would be nice to include this 2 core annotations?
Comment From: sbrannen
I initially proposed those two composed annotations in #18022, but the Spring team decided against inclusion of them at the time.
Labeling with "for: team-attention" to discuss if the team would like to consider introducing such scope annotations now.
Comment From: sbrannen
After some internal discussions, we have decided that we do not wish to introduce composed annotations for singleton and prototype scopes, since we feel that they do not add much value over @Scope("singleton")
and @Scope("prototype")
declarations, especially since singleton is the default.
You are of course free to implement such composed annotations and use them in your own projects if you feel that they add value for your team.
Thanks anyway for the PR!
Comment From: bojanv55
After some internal discussions, we have decided that we do not wish to introduce composed annotations for singleton and prototype scopes, since we feel that they do not add much value over
@Scope("singleton")
and@Scope("prototype")
declarations, especially since singleton is the default.You are of course free to implement such composed annotations and use them in your own projects if you feel that they add value for your team.
Thanks anyway for the PR!
For singleton, you can say that it is default so there - it makes sense to leave it out (the only reason for inclusion would be consistency). But for prototype, I guess you would get compile time safety since otherwise you can always write something like @Scope("prototipe")
and have program start without any problem until actual injection..
Comment From: hannah23280
Truely hope this can be reopened again. I agree it might not add value, but at least it ensures consistency. Easy for learner to grasp it. And help to shorten the "syntax".
And beside these 2, also wish there are @WebSocketScope. To make things worse, my understanding is that defining websocket scope would look like this currently
@Scope(scopeName="websocket", proxyMode=ScopedProxyMode.TARGET_CLASS
) and defining Singleton/Prototype scope look like this
@Scope(value=ConfigurableBeanFactory.SCOPE_SINGLETON)
.
Inconsistent again, as one use scopeName attribute, and the other use value attribute