spring-projects / spring-shell

Spring based shell
http://projects.spring.io/spring-shell/
Apache License 2.0
723 stars 395 forks source link

When using Spring Shell, no ApplicationReadyEvent will be published #298

Open fionera opened 4 years ago

fionera commented 4 years ago

When I use Spring Shell, the ApplicationReadyEvent will never be published and new SpringApplicationBuilder(Application.class).run(args) also never returns

rmartinsanta commented 4 years ago

@Order(Ordered.HIGHEST_PRECEDENCE) can be used as a workaround, makes your Component/Listener run before the shell starts.

fionera commented 4 years ago

I replaced the ApplicationStarter from SpringShell with a Lifecycle Component. That helped too and is better suited for the task :)

comrada commented 4 years ago

I have the same problem. @fionera, could you describe your workaround in more detail?

fionera commented 4 years ago

I disabled spring shell and made this class to start it. https://github.com/CleanstoneMC/Cleanstone/blob/master/src/main/java/rocks/cleanstone/console/InteractiveShellLifecycle.java

davidrochin commented 4 years ago

I disabled spring shell and made this class to start it. https://github.com/CleanstoneMC/Cleanstone/blob/master/src/main/java/rocks/cleanstone/console/InteractiveShellLifecycle.java

How do you disable Spring Shell?

fionera commented 4 years ago

@davidrochin You can disable it by setting the following in your application.yml

spring:
  shell:
    interactive:
      enabled: false