spring_reference/X. Appendices/D.1. Nested JARs.md

6 lines
648 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

### 附录D.1. 内嵌JARs
Java没有提供任何标准的方式来加载内嵌的jar文件也就是jar文件自身包含到一个jar中。如果你正分发一个在不解压缩的情况下可以从命令行运行的自包含应用那这将是个问题。
为了解决这个问题,很多开发者使用"影子" jars。一个影子jar只是简单的将所有jars的类打包进一个单独的"超级jar"。使用影子jars的问题是它很难分辨在你的应用中实际可以使用的库。在多个jars中存在相同的文件名内容不同也是一个问题。Spring Boot另劈稀径让你能够直接嵌套jars。