你好,
创建 bean 实现 NotificationChannel
接口就可以定义自己的通道:
@Component("tst_WeChatChannel")
public class WeChatChannel implements NotificationChannel {
@Override
public String getName() {
return "微信通道";
}
@Override
public boolean send(Notification notification) {
System.out.println("Sending:" + notification.getSubject() + " to:" + notification.getRecipient());
return true;
}
}
添加通道名称的消息键值:
com.company.test.bean/WeChatChannel=WeChat Channel
效果:
1 个赞