Class SwitchableApplicationListener<E extends org.springframework.context.ApplicationEvent>

java.lang.Object
org.miaixz.bus.spring.listener.SwitchableApplicationListener<E>
All Implemented Interfaces:
EventListener, org.springframework.context.ApplicationListener<E>

public abstract class SwitchableApplicationListener<E extends org.springframework.context.ApplicationEvent> extends Object implements org.springframework.context.ApplicationListener<E>
ApplicationListener可以使用属性来动态启用侦听器
Since:
Java 17+
Author:
Kimi Liu
  • Constructor Details

    • SwitchableApplicationListener

      public SwitchableApplicationListener()
  • Method Details

    • onApplicationEvent

      public void onApplicationEvent(E event)
      Specified by:
      onApplicationEvent in interface org.springframework.context.ApplicationListener<E extends org.springframework.context.ApplicationEvent>
    • doOnApplicationEvent

      protected abstract void doOnApplicationEvent(E event)
    • switchKey

      protected abstract String switchKey()
      从 bus.switch.listener 开始
      Returns:
      开关键,不能为空。
    • matchIfMissing

      protected boolean matchIfMissing()
      指定如果未设置属性,是否应该匹配条件。默认为true
      Returns:
      如果属性缺失,则条件应该匹配
    • isEnable

      protected boolean isEnable(org.springframework.core.env.Environment environment)