Class WorkspaceBeanScope

java.lang.Object
com.github._1c_syntax.bsl.languageserver.infrastructure.WorkspaceBeanScope
All Implemented Interfaces:
Scope

public class WorkspaceBeanScope extends Object implements Scope
Custom Spring Scope для per-workspace бинов.

Ключ scope — workspace URI из WorkspaceContextHolder. Если workspace URI не установлен, выбрасывается исключение.

  • Field Details

  • Constructor Details

    • WorkspaceBeanScope

      public WorkspaceBeanScope()
  • Method Details

    • get

      public Object get(String name, ObjectFactory<?> objectFactory)
      Specified by:
      get in interface Scope
    • remove

      public @Nullable Object remove(String name)
      Specified by:
      remove in interface Scope
    • registerDestructionCallback

      public void registerDestructionCallback(String name, Runnable callback)
      Specified by:
      registerDestructionCallback in interface Scope
    • resolveContextualObject

      public @Nullable Object resolveContextualObject(String key)
      Specified by:
      resolveContextualObject in interface Scope
    • getConversationId

      public @Nullable String getConversationId()
      Specified by:
      getConversationId in interface Scope
    • removeWorkspace

      public void removeWorkspace(URI workspaceUri)
      Удалить все бины workspace, предварительно вызвав destruction callbacks.
    • getAllInstances

      public <T> Collection<T> getAllInstances(String beanName, Class<T> type)
      Get all instances of a bean across all workspaces.
      Parameters:
      beanName - the bean name
      type - the expected type
      Returns:
      collection of all instances
    • getRegisteredWorkspaceUris

      public Collection<URI> getRegisteredWorkspaceUris()
      Returns:
      URI всех зарегистрированных в scope workspace'ов. Полезно для test-cleanup'а, который должен пройтись по каждому scope для сброса состояния workspace-scoped beans.