小编Pau*_*mas的帖子

如何在apache commons daemon jsvc启动时设置嵌套类加载?

我想使用jsvc启动我的spring启动应用程序,因为它已经在目标系统上,另一种方法是花时间调试shell脚本以获取边缘情况.我已经实现了守护进程接口,因此SpringApplication.run()被调用Daemon.start()但是找不到嵌套的jar,因为我绕过了JarLoader.

有没有办法以编程方式设置正确的类加载器等?

@Configuration
@EnableAutoConfiguration
@ComponentScan
@EnableConfigurationProperties
public class Application implements Daemon {
 private ConfigurableApplicationContext ctx;
 private String[] args;

  @Override
  public void init(DaemonContext context) throws Exception {
    args = context.getArguments();
  }

  @Override
  public void start() throws Exception {
    ctx = SpringApplication.run(Application.class, args);
  }

  @Override
  public void stop() throws Exception {
    ctx.stop();
  }

  @Override
  public void destroy() {
    ctx.close();
  }

  // Main - mostly for development.
  public static void main(String[] args) throws Exception {
    System.err.println("WARNING - …
Run Code Online (Sandbox Code Playgroud)

jsvc spring-boot

8
推荐指数
1
解决办法
679
查看次数

标签 统计

jsvc ×1

spring-boot ×1