spring.shell.interactive.enabled=false makes autoconf fail
The exception is quite explicit, but anyway : https://github.com/spring-projects/spring-shell/blob/7d5d4e4f5e7162b925848d85b604dc7907736b5b/spring-shell-autoconfigure/src/main/java/org/springframework/shell/boot/ShellRunnerAutoConfiguration.java#L53
Conditions are badly handled here. There should be a @ConditionalOnProperty(prefix = "spring.shell.interactive", name = "enabled", havingValue = "true", matchIfMissing = "true")
on jlineShellRunner and systemShellRunner.
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 0 of method springShellApplicationRunner in org.springframework.shell.boot.ShellRunnerAutoConfiguration required a single bean, but 2 were found:
- jlineShellRunner: defined by method 'jlineShellRunner' in class path resource [org/springframework/shell/boot/ShellRunnerAutoConfiguration.class]
- nonInteractiveShellRunner: defined by method 'nonInteractiveShellRunner' in class path resource [org/springframework/shell/boot/ShellRunnerAutoConfiguration.class]
As a side note : there is no existing test using spring.shell.interactive.enabled=false :(
I forgot to add that everything was working well with M1.
Also, while this is unrelated, I shoud also add that there were lots of undocumented changes to ABI between M1 and RC1. I had to dig the git history to understand changes (which are ok btw) For example ShellOption -> Option, ShellMethod -> Command
This is a valid issue, thank you for reporting it as early as RC was released! I am in the process of stabilizing this RC and I was expecting some bumps and corner cases after the major overhaul in v4. I will fix this conditional issue and add more test coverage for the upcoming GA.
Also, while this is unrelated, I shoud also add that there were lots of undocumented changes to ABI between M1 and RC1. I had to dig the git history to understand changes (which are ok btw)
Yes, I was working on that already. Here is the migration guide: https://github.com/spring-projects/spring-shell/wiki/v4-migration-guide (it is still in progress as we are not GA yet, but it contains already a big chunk of the migration effort one should be aware of). Please report any missing information you might have and I will update it accordingly.
For example ShellOption -> Option, ShellMethod -> Command
However, this change is not really related to v4 per se. Those annotations were already documented as deprecated in v3 (called legacy annotations in the reference docs) and you should have migrated to @Command already in v3. Are you migrating from v2 to v4 directly?
Hi, @fmbenhassine. Can I work on this?
@therepanic I am working on this already and going to push shortly. Thank you for your offer to help anyway 🙏 I am going to open a couple known issues in RC, I will cc you if you are interested.
@fbus The issue should be fixed in the latest v4.0 snapshots.
I added a test case and also a sample for non-interactive apps: https://github.com/spring-projects/spring-shell/tree/main/spring-shell-samples/spring-shell-sample-non-interactive
Please let me know if you need help in your migration journey.
Thanks ! Yeah this is an old codebase migrated from v2 to v3 and then to v4-M1. As far as I can tell, ShellCommand and ShellOption were not deprecated at that time. But maybe I missed they were marked as legacy in the documentation sorry 😁