Skip to content

Provide @WebSocketScope annotation and public SCOPE_WEBSOCKET constant (for consistency with @RequestScope and co) #35235

@hannah23280

Description

@hannah23280

Spring framework : 6.2.8

Currently, to use the scope name for bean, we can use

BeanDefinition or ConfigurableBeanFactory interfaces which contain

  1. SCOPE_SINGLETON
  2. SCOPE_PROTOTYPE

WebApplicationContext interface which contain

  1. SCOPE_REQUEST
  2. SCOPE_SESSION
  3. SCOPE_APPLICATION
    Alternatively, we can use @requestScope, @SessionScope and @ApplicationScope

For web socket scope, simply use the string "websocket" as the scope name

================================================================

Problem: The above usage is inconsistent. Why not, make it consistent across the board
Possible Suggestions:

  1. BeanDefinition or ConfigurableBeanFactory interface contains all the 6 scopes

  2. Introduce @SingletonScope, @PrototypeScope and @WebSocketScope

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions