MiraiForum

    • Register
    • Login
    • Search
    • Popular
    • Recent
    • Unsolved
    • Tags
    • Groups
    • 友情链接

    Kotlin怎么调用Hutool的CronUtil动态添加定时任务?

    开发交流
    2
    2
    57
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • N
      N70_ last edited by N70_

      官方参考文档只有Java代码如下:

      CronUtil.schedule("*/2 * * * * *", new Task() {
          @Override
          public void execute() {
              some code
          }
      });
      

      在IDEA中自动转换的JAVA代码如下:
      a92caf54-2010-4000-bc1f-43e2e36d8a83-image.png
      报错
      2d0553da-22f3-414c-8950-73d6f7580eea-image.png

      1 Reply Last reply Reply Quote 0
      • cssxsh
        cssxsh last edited by

        CronUtil.schedule("*/2 * * * * *", Task {
        // do some
        });

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        Powered by Mamoe Technologies & NodeBB | 友情链接 | 服务监控 | Contact