kakawait / picocli-spring-boot-starter

Spring boot starter for Picocli command line parser that will simplify your CommandLineRunner
MIT License
51 stars 6 forks source link

Replacement or complementary of ApplicationRunner? #6

Open gerardbosch opened 6 years ago

gerardbosch commented 6 years ago

Hi there! I don't know where to ask the following. Is this starter compatible with Spring ApplicationRunners? I have a small application consisting of several Spring ApplicationRunners, but I am not sure if @Command annotated class/es is/are designated to be a replacement of ApplicationRunner. I couldn't manage to get it working together as call() method in command class does not get executed (at least before ApplicationRunners run).

What I try to achieve is to run picocli before any of my existing runners start in order to parse args and setup some stuff in a Spring Bean. Then run the runners that will make use of that configured bean.

Do I need to replace my ApplicationRunner classes with something provided by this starter? Thx!

kakawait commented 5 years ago

@gerardbosch sorry for delay. Yes @Command in that starter will generate at the end an CommandLineRunner class which is similar to ApplicationRunner.

So it could be a perfect replacement.

However you said you're not successfully manage the transition, do you have a sample app to test?

But problem seems to be related to order. I'll try to check if we can affect order to be run before other ApplicationRunner