wechaty / java-wechaty-getting-started

Java Wechaty Starter Project Template that Works Out-of-the-Box
https://gitpod.io/#https://github.com/wechaty/java-wechaty-getting-started
Apache License 2.0
46 stars 41 forks source link

How to configure to springboot project #24

Open wu1005690803 opened 4 years ago

wu1005690803 commented 4 years ago

How to configure to springboot project

diaozxin007 commented 4 years ago

目前没有提供直接可用的 springboot starter. 你可以尝试自己写一个. 现在可以尝试在 @Configrationable 类里面。初始化。然后就可以

@Bean
public Wecahty wecahty(){
    return Wechaty.instance()
      .onScan((qrcode, statusScanStatus, data) -> System.out.println(QrcodeUtils.getQr(qrcode)))
      .onLogin(user -> System.out.println("User logined :" + user))
      .onMessage(message -> System.out.println("Message:" + message))
      .start(true);
}
@Autowired
private Wecahty wechaty