spring-projects / spring-shell

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

3.3.0-RC1 spring shell version doesn't show the shell prompt #1081

Closed madukan closed 1 month ago

madukan commented 1 month ago

I used the start.spring.io intializer to generate a Spring Shell project with GraalVM. The version 3.3.0 Spring Boot with the Spring Shell version 3.3.0-RC1 does not by default (or able to get there in anyway I could see) get to the shell prompt (shell:>).

This is the POM overall. And will attach the sample project too to this.

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.3.0</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>demo</name>
    <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>21</java.version>
        <spring-shell.version>3.3.0-RC1</spring-shell.version>
    </properties>

Would it be possible to get some light shed on this please? I'm not sure if its a but or some expected changes here.

A sample project to demonstrate the issue: demo 2.zip

Observation The parameters seem to work (hello custom command, help default commands etc would print the outputs as expected.). However not the standard prompt.

Wen run with no parameters application exits with below lines at the end:

2024-05-31T21:58:21.817+10:00  INFO 9047 --- [demo] [           main] com.example.demo.DemoApplication         : Started DemoApplication in 0.943 seconds (process running for 1.217)

Process finished with exit code 0

Expected result Expectation is that when the project is run (DemoApplication class), the shell prompt should come thorough and let the user interact.

2024-05-31T22:00:02.507+10:00  INFO 9064 --- [demo] [           main] com.example.demo.DemoApplication         : Started DemoApplication in 0.738 seconds (process running for 1.024)
shell:>

NOTE: <spring-shell.version>3.2.4</spring-shell.version> works fine. Only <spring-shell.version>3.3.0-RC1</spring-shell.version> found to have this issue.

madukan commented 1 month ago

Just found out this is due to by default interactive mode is set to off in Spring Shell 3.3.0-RC1. Not sure if this is by design.

I was able to re-enable by adding the following to application.properties.

spring.shell.interactive.enabled=true

An updated version of the same project: demo 3.zip

jvalkeal commented 1 month ago

Indeed this is intended breaking change in 3.3.x mentioned in https://docs.spring.io/spring-shell/reference/3.3/execution.html#using-shell-execution-shellrunner.

Part of better testing stories so that default skeleton project would not hang when running tests which was always confusing for users.

madukan commented 1 month ago

I see. Thanks for confirming.

So no more meddling with the test configurations like this then! :

@SpringBootTest("spring.shell.interactive.enabled=false")
jvalkeal commented 1 month ago

Yes, that was partially motivation for a change and we can only do behavioural changes like this with minor versions.