使用Visual Studio+Service Fabric运行Spring Boot微服务
Service Fabric是微软提供的微服务管理框架,经过了微软Cosmos DB等多个产品的验证。
Service Fabric官方文档只提供了Visual Studio + .net + C#的开发部署方案和Linux + Eclipse + Java的部署方案,但没有Visual Studio+Eclipse+Java的部署方法,通过摸索和文档,发现微软提供了这样的途径,微软真是比以前开放多了。
1. 首先在Visual Studio中创建Service Fabric工程,
2. 选择来宾可执行文件,输入第一个微服务的名称,选择可执行的jar包所在文件目录,Work Folder选为CodeBase,
3. 在VS项目树中,选择Jar包,同时将java运行环境包复制/粘贴到code目录中,
4. 打开"ServiceManifest.xml", 更改以下参数,
- Program: This should point to java.exe file in JRE folder that was copied.
- Arguments: This should contain the -jar and path of the JAR filename relative to java.exe. They are arguments passed to java.exe when it starts.
- WorkingFolder: This should be CodeBase.
- Endpoint: Name a endpoint and provide protocol as HTTP and port no (8080) along with type(input)
5. 点击Start按钮,就可以将此微服务部署搭配本地Service Fabric Cluster上了,