Skip to content

Commit b03d81b

Browse files
committed
Update ManifestArtifactResourceResolver.java
1 parent 9d36e57 commit b03d81b

1 file changed

Lines changed: 44 additions & 1 deletion

File tree

microsphere-java-core/src/main/java/io/microsphere/classloading/ManifestArtifactResourceResolver.java

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,50 @@
3232
import static java.lang.System.getProperty;
3333

3434
/**
35-
* {@link ArtifactResourceResolver} for Manifest
35+
* {@link ArtifactResourceResolver} implementation that reads artifact metadata from JAR manifest files.
36+
*
37+
* <p>This resolver looks for artifact information in the {@code META-INF/MANIFEST.MF} file of a JAR or directory.
38+
* It extracts the artifact ID and version using configurable manifest attributes.</p>
39+
*
40+
* <h3>Configuration Options</h3>
41+
* <p>You can customize which manifest attributes are used to extract the artifact ID and version by setting system properties:</p>
42+
*
43+
* <ul>
44+
* <li><strong>{@value #ARTIFACT_ID_ATTRIBUTE_NAMES_PROPERTY_NAME}</strong>: A comma-separated list of attribute names to use for extracting the artifact ID.
45+
* Default: {@value #DEFAULT_ARTIFACT_ID_ATTRIBUTE_NAMES_PROPERTY_VALUE}</li>
46+
* <li><strong>{@value #VERSION_ATTRIBUTE_NAMES_PROPERTY_NAME}</strong>: A comma-separated list of attribute names to use for extracting the artifact version.
47+
* Default: {@value #DEFAULT_VERSION_ATTRIBUTE_NAMES_PROPERTY_VALUE}</li>
48+
* </ul>
49+
*
50+
* <h3>Example Usage</h3>
51+
* <pre>
52+
* // Using default priority
53+
* ArtifactResourceResolver resolver = new ManifestArtifactResourceResolver();
54+
*
55+
* // With custom priority
56+
* ArtifactResourceResolver resolver = new ManifestArtifactResourceResolver(10);
57+
*
58+
* // With custom class loader and priority
59+
* ArtifactResourceResolver resolver = new ManifestArtifactResourceResolver(getClass().getClassLoader(), 10);
60+
* </pre>
61+
*
62+
* <h3>Manifest Attribute Examples</h3>
63+
* <p>The resolver will look at standard and custom manifest attributes. Here's an example MANIFEST.MF:</p>
64+
*
65+
* <pre>
66+
* Manifest-Version: 1.0
67+
* Bundle-Name: my-artifact
68+
* Bundle-Version: 1.2.3
69+
* Implementation-Title: my-artifact
70+
* Implementation-Version: 1.2.3
71+
* Automatic-Module-Name: com.example.myartifact
72+
* </pre>
73+
*
74+
* <p>In this case, the resolver would extract:</p>
75+
* <ul>
76+
* <li><strong>Artifact ID:</strong> "my-artifact" (from Bundle-Name)</li>
77+
* <li><strong>Version:</strong> "1.2.3" (from Bundle-Version)</li>
78+
* </ul>
3679
*
3780
* @author <a href="mailto:mercyblitz@gmail.com">Mercy</a>
3881
* @see StreamArtifactResourceResolver

0 commit comments

Comments
 (0)