com.healthy.common.websocket.holder.JsonMessageHandlerInitializer Maven / Gradle / Ivy
package com.healthy.common.websocket.holder;
import com.healthy.common.websocket.handler.JsonMessageHandler;
import com.healthy.common.websocket.message.JsonWebSocketMessage;
import lombok.RequiredArgsConstructor;
import javax.annotation.PostConstruct;
import java.util.List;
/**
* JsonMessageHandler 初始化器 将所有的 jsonMessageHandler 收集到 JsonMessageHandlerHolder 中
*
* @author xm.z
*/
@RequiredArgsConstructor
public class JsonMessageHandlerInitializer {
private final List> jsonMessageHandlerList;
@PostConstruct
public void initJsonMessageHandlerHolder() {
for (JsonMessageHandler extends JsonWebSocketMessage> jsonMessageHandler : jsonMessageHandlerList) {
JsonMessageHandlerHolder.addHandler((JsonMessageHandler) jsonMessageHandler);
}
}
}