无需重启服务即可轻松部署 .jar 文件

Easily deploying .jar files without restarting the service

我想知道是否有一种简单的方法可以在不重新启动服务的情况下轻松部署 .jar?我发现了几个不同的帖子,但它们有点旧,他们提到使用名为 JavaLoader Programmatic reloading of Java JARs without restarting ColdFusion 的库是否有替代方法?我正在使用 java sdk 进行开发,每次更改后继续重新启动非常耗时,我宁愿不使用库来完成此操作。

编辑:我使用的是 Lucee 5.2

对于 Lucee,Javaloader 是必经之路。 https://github.com/markmandel/JavaLoader. The library might be a little old, but so is ColdFusion. Javaloader has never been replaced because it works really well and a replacement isn't needed. The developer, Mark Mandel, is a very smart guy who works for Google now. You can see what he's up to at https://twitter.com/Neurotic.

Javaloader 一旦您了解了如何配置它就很容易使用。它接受 Java 库的一系列路径。配置完成后,使用 javaloader.create() 调用您的 类:

jars = [ expandPath( "/classes/mypackage.jar" ) ];
javaloader = createObject("component", "javaloader.JavaLoader").init( sourceDirectories = jars );
myclass = javaloader.create( "myclass" ).init();