且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Spring使用的Java类路径

更新时间:2023-01-11 10:53:00

要获得与林中相同的效果k发布后,您可以在静态初始值设定项中获得类路径(与示例相同,只有在 static {...} 块而不是main中)方法。 JVM将首先执行静态初始化程序,然后再加载您的类依赖的其他任何类(除了您在静态初始化程序中引用的类之外​​)。

To get the same effect as you have in the link you posted, you could get the classpath in a static initializer (just do the same as the example, only then in a static { ... } block instead of a main method. The JVM will execute the static initializer first, before loading any other classes your class depends on (other than the classes you reference in the static initializer).