spring_reference/X. Appendices/D.3.1. Launcher manifest.md

16 lines
738 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.3.1 Launcher manifest
你需要指定一个合适的Launcher作为`META-INF/MANIFEST.MF`的`Main-Class`属性。你实际想要启动的类也就是你编写的包含main方法的类需要在`Start-Class`属性中定义。
例如这里有个典型的可执行jar文件的MANIFEST.MF
```properties
Main-Class: org.springframework.boot.loader.JarLauncher
Start-Class: com.mycompany.project.MyApplication
```
对于一个war文件它可能是这样的
```properties
Main-Class: org.springframework.boot.loader.WarLauncher
Start-Class: com.mycompany.project.MyApplication
```
**注**你不需要在manifest文件中指定`Class-Path`实体classpath会从嵌套的jars中被推导出来。