切换类加载器,解决Java Services 加载问题(大概也能解决Spring的上下文问题)
-
val thread = Thread.currentThread() val oc = thread.contextClassLoader try { thread.contextClassLoader = XXXPlugin::class.java.classLoader // 需要切换上下文的代码 } finally { thread.contextClassLoader = oc }
-
-