Package org.miaixz.bus.spring.listener
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voiddoOnApplicationEvent(E event) protected booleanisEnable(org.springframework.core.env.Environment environment) protected boolean指定如果未设置属性,是否应该匹配条件。voidonApplicationEvent(E event) protected abstract String从 bus.switch.listener 开始
-
Constructor Details
-
SwitchableApplicationListener
public SwitchableApplicationListener()
-
-
Method Details
-
onApplicationEvent
- Specified by:
onApplicationEventin interfaceorg.springframework.context.ApplicationListener<E extends org.springframework.context.ApplicationEvent>
-
doOnApplicationEvent
-
switchKey
从 bus.switch.listener 开始- Returns:
- 开关键,不能为空。
-
matchIfMissing
protected boolean matchIfMissing()指定如果未设置属性,是否应该匹配条件。默认为true。- Returns:
- 如果属性缺失,则条件应该匹配
-
isEnable
protected boolean isEnable(org.springframework.core.env.Environment environment)
-