dreamhead / moco

Easy Setup Stub Server
MIT License
4.35k stars 1.08k forks source link

用BootStrap setting文件的方式启动,如果json文件改错一次后,服务将不可用,一定要重启 #304

Open jingzhongwen opened 2 years ago

jingzhongwen commented 2 years ago

1、我在应用代码中直接使用了BootStrap来启动服务,如下: bootstrap.run(new String[]{serverType, "-p", port, "-g", filePath}); 2、服务正常启动,然后估计改错JSON文件报如下错: zaip-csbc-operation-service|WARN |2021-09-28 10:30:08,434|pool-1-thread-1|c.g.d.m.r.watcher.WatcherFactory|WatcherFactory.java:42|########com.fasterxml.jackson.databind.JsonMappingException: Unexpected character ('C' (code 67)): was expecting double-quote to start field name at [Source: (String)"[ { **CC**"request": { 3、把JSON文件改回来后,依然报错,无法启动 ########Fail to load configuration in pbs.getUserInfoByIdNo.json.

dreamhead commented 2 years ago

Try to build your own Moco to check if it is fixed.

./gradlew proguard
maodou38 commented 2 years ago

Recent,i use standalone mock server as a docker service and i find that the configuration change auto restart is fail.So i read the code about it,i find the auto restart service is based on java7's watchservice.And in docker environment,it won't trigger any file change events. So can we use the basic way to monitor the file change such as use a schedule file scanner to do this. Watchservice is out-of-date in cloud service.