【发布时间】:2018-05-11 13:01:07
【问题描述】:
我们正在使用 Spring-boot 来构建微服务。在我的项目设置中,我们有一个名为 platform-boot 的通用 maven 模块,主类带有注释 SpringBootApplication
如果我们想创建一个新的微服务(比如Service-1),我们只需添加一个platform-boot模块的依赖并提供 pom.xml 中的 main-class 路径,我们可以开始了。
问题是当我尝试通过在依赖模块的“主类”中编写代码来读取 Service-1 的Manifest.MF 文件时。它读取platform-boot的Manifest.MF文件。
下面是我在主类中读取Manifest.MF文件的代码sn-p。
MyMain.class.getProtectionDomain().getCodeSource().getLocation().getPath();
//Returns the path of MyMain.class which is nested jar
请提出一种读取Service-1的Manifest.MF文件的方法。
PS:我想阅读Maifest.MF 文件以获取实施版本。请建议是否还有其他获取方式。
【问题讨论】:
标签: java maven spring-boot manifest manifest.mf