Class RefreshScope

java.lang.Object
io.micronaut.runtime.context.scope.refresh.RefreshScope
All Implemented Interfaces:
io.micronaut.context.event.ApplicationEventListener<RefreshEvent>, io.micronaut.context.LifeCycle<RefreshScope>, io.micronaut.context.scope.CustomScope<Refreshable>, io.micronaut.core.order.Ordered, Closeable, AutoCloseable, EventListener

@Singleton @Requires(condition=RefreshScopeCondition.class) public class RefreshScope extends Object implements io.micronaut.context.scope.CustomScope<Refreshable>, io.micronaut.context.LifeCycle<RefreshScope>, io.micronaut.context.event.ApplicationEventListener<RefreshEvent>, io.micronaut.core.order.Ordered
Implementation of Refreshable.
Since:
1.0
See Also:
  • Field Details

  • Constructor Details

    • RefreshScope

      public RefreshScope(io.micronaut.context.BeanContext beanContext)
      Parameters:
      beanContext - The bean context to allow DI of beans annotated with @Inject
  • Method Details

    • isRunning

      public boolean isRunning()
      Specified by:
      isRunning in interface io.micronaut.context.LifeCycle<RefreshScope>
    • annotationType

      public Class<Refreshable> annotationType()
      Specified by:
      annotationType in interface io.micronaut.context.scope.CustomScope<Refreshable>
    • getOrCreate

      public <T> T getOrCreate(io.micronaut.context.scope.BeanCreationContext<T> creationContext)
      Specified by:
      getOrCreate in interface io.micronaut.context.scope.CustomScope<Refreshable>
    • stop

      public RefreshScope stop()
      Specified by:
      stop in interface io.micronaut.context.LifeCycle<RefreshScope>
    • remove

      public <T> Optional<T> remove(io.micronaut.inject.BeanIdentifier identifier)
      Specified by:
      remove in interface io.micronaut.context.scope.CustomScope<Refreshable>
    • onApplicationEvent

      public void onApplicationEvent(RefreshEvent event)
      Specified by:
      onApplicationEvent in interface io.micronaut.context.event.ApplicationEventListener<RefreshEvent>
    • onRefreshEvent

      public final void onRefreshEvent(RefreshEvent event)
      Handle a RefreshEvent synchronously. This method blocks unlike onApplicationEvent(RefreshEvent).
      Parameters:
      event - The event
    • getOrder

      public int getOrder()
      Specified by:
      getOrder in interface io.micronaut.core.order.Ordered
    • findBeanRegistration

      public <T> Optional<io.micronaut.context.BeanRegistration<T>> findBeanRegistration(T bean)
      Specified by:
      findBeanRegistration in interface io.micronaut.context.scope.CustomScope<Refreshable>
    • getLock

      protected ReadWriteLock getLock(Object object)
      Parameters:
      object - The bean
      Returns:
      The lock on the object