一直记得META-INF中只有在直接启动jar可执行文件时需要在manifest中配置启动类,最近看dubbo的配置,发现dubbo的配置都丢在META-INF下,特地搜索了下,官网对于META-INF的说明如下:

The META-INF directory

The following files/directories in the META-INF directory are recognized and interpreted by the Java 2 Platform to configure applications, extensions, class loaders and services:

  • MANIFEST.MF

The manifest file that is used to define extension and package related data.

  • INDEX.LIST

This file is generated by the new "-i" option of the jar tool, which contains location information for packages defined in an application or extension.  It is part of the JarIndex implementation and used by class loaders to speed up their class loading process.

  • x.SF

The signature file for the JAR file.  'x' stands for the base file name.

  • x.DSA

The signature block file associated with the signature file with the same base file name. This file stores the digital signature of the corresponding signature file.

  • services/

This directory stores all the service provider configuration files.

一般来说,META-INF下不会存储和应用配置相关的信息。而且可以认为是Java自己的元数据目录。其他应用配置,应该放在其他目录比如conf。

花若盛开,蝶自飞来,你若精彩,幸福开怀!2020年12月11日-18日