您当前的位置: 首页 > 

蓝不蓝编程

暂无认证

  • 4浏览

    0关注

    706博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

ktor热部署(Automatic Reloading)

蓝不蓝编程 发布时间:2019-05-04 11:09:04 ,浏览量:4

简要介绍

在开发过程中,如果修改了文件,必须要重启容器,那效率就太低了. 本文介绍一下使用ktor时,如何实现热部署(Automatic Reloading),仅限类,不包括配置文件.

操作步骤
  1. application.conf配置(如果是通过代码配置的服务器启动参数,请参考附录中官方指导) 在deployment节点下增加watch,里面放本工程目录名,ktor会根据这个目录名来过滤要热部署的类.
ktor {
  deployment {
    port = 8080
    watch = [ ktorJwtDemo ]
  }
}
  • 如果配置正确,启动后会打印类似如下信息:
Application - Watching /Users/jerry/projects/mine/gitee/test/ktorJwtDemo/out/production/resources for changes.
Application - Watching /Users/jerry/projects/mine/gitee/test/ktorJwtDemo/out/production/classes/com/cxyxy/ktor/jwt/demo for changes.
Application - Responding at http://0.0.0.0:8080
  • 如果未配置,启动后会打印类似如下信息:
No ktor.deployment.watch patterns specified, automatic reload is not active
  • 如果配置错误,启动后会打印类似如下信息:
No ktor.deployment.watch patterns match classpath entries, automatic reload is not active
  1. 当修改了类后,手动编译了工程或者指定类. 如果不想每次手动编译,可以设置自动编译,借助插件Save Actions即可.
附录

官方指导: Saving Time with Automatic Reloading

安卓开发技术分享: https://blog.csdn.net/yinxing2008/article/details/84555061 点击关注专栏,查看最新技术分享 更多技术总结好文,请关注:「程序园中猿」

关注
打赏
1639405877
查看更多评论
立即登录/注册

微信扫码登录

0.0376s