创建一个Helidon项目
新建一个项目,点击【File】=》【New】=》【Project】:
选择【MicroProfile Starter】,其他选项请参考截图:
【MicroProfile Versions】中的选项值如下:
【MicroProfile Implementations】中的选项值如下:
点击【Next】后,提示需要“JDK 8”:
重新选择“JDK 8”,点击【Next】:
点击【Finish】:
MicroProfile Starter创建了2个MicroProfile应用程序。
运行service-a和service-b
点击【Run】=》【Run】,或者快捷方式Alt+Shift+F10:
点击【Edit Configurations】:
点击【+】图标,输入"java",点击【Cucumber java】:
输入下面项目,然后点击【Apply】:
Name:service-a
Main class:io.helidon.microprofile.server.Main
Feature or folder path:E:\idea_workspace\studyhelidon\service-a(请根据各自实际情况修改)
Use classpath of module:studyhelidon-service-a
选择service-a,然后点击复制图标(或者快捷方式Ctrl+D):
修改各个项目信息如下:
Name:service-b
Main class:io.helidon.microprofile.server.Main
Feature or folder path:E:\idea_workspace\studyhelidon\service-b(请根据各自实际情况修改)
Use classpath of module:studyhelidon-service-b
然后点击【close】关闭对话框。
点击【Run】=》【Run】,或者快捷方式Alt+Shift+F10:
点击【service-a】:
service-a正常启动时输出日志如下:
点击【Run】=》【Run】,或者快捷方式Alt+Shift+F10:
点击【service-b】:
service-b正常启动时输出日志如下:
打开浏览器访问service-a的服务地址,http://localhost:8080,显示结果如下:
service-b的服务地址,http://localhost:8180,需要从service-a调用。如果直接打开会显示:No handler found for path: /。
完结!