Skip to content

Commit

Permalink
Отвязывание от CommandLineRunner для основного класса приложения
Browse files Browse the repository at this point in the history
Чтобы исключить запуск сервера каждый раз при поднятии спринг-контекста.
  • Loading branch information
nixel2007 committed Jul 28, 2023
1 parent fc6b506 commit 7bc0f54
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import com.github._1c_syntax.bsl.languageserver.cli.WebsocketCommand;
import com.github._1c_syntax.utils.CaseInsensitivePattern;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.ExitCodeGenerator;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
Expand Down Expand Up @@ -71,7 +70,7 @@
havingValue = "true",
matchIfMissing = true)
@RequiredArgsConstructor
public class BSLLSPLauncher implements Callable<Integer>, CommandLineRunner, ExitCodeGenerator {
public class BSLLSPLauncher implements Callable<Integer>, ExitCodeGenerator {

private static final String DEFAULT_COMMAND = "lsp";

Expand Down Expand Up @@ -106,15 +105,17 @@ public static void main(String[] args) {
var applicationContext = new SpringApplicationBuilder(BSLLSPLauncher.class)
.web(getWebApplicationType(args))
.run(args);

var launcher = applicationContext.getBean(BSLLSPLauncher.class);
launcher.run(args);

if (launcher.getExitCode() >= 0) {
System.exit(
SpringApplication.exit(applicationContext)
);
}
}

@Override
public void run(String... args) {
var cmd = new CommandLine(this, picocliFactory);

Expand Down

0 comments on commit 7bc0f54

Please sign in to comment.