Skip to content

Commit e159cfc

Browse files
committed
Change properties for interactive and script to false on default
- Change defaults for `spring.shell.interactive.enabled` and `spring.shell.script.enabled` to false. - Change samples to use interactive/script where applicable. - Fixes #1051
1 parent 290dd85 commit e159cfc

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

spring-shell-autoconfigure/src/main/java/org/springframework/shell/boot/SpringShellProperties.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2021-2023 the original author or authors.
2+
* Copyright 2021-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -162,7 +162,7 @@ public void setEnabled(boolean enabled) {
162162

163163
public static class Script {
164164

165-
private boolean enabled = true;
165+
private boolean enabled = false;
166166

167167
public boolean isEnabled() {
168168
return enabled;
@@ -175,7 +175,7 @@ public void setEnabled(boolean enabled) {
175175

176176
public static class Interactive {
177177

178-
private boolean enabled = true;
178+
private boolean enabled = false;
179179

180180
public boolean isEnabled() {
181181
return enabled;

spring-shell-autoconfigure/src/test/java/org/springframework/shell/boot/SpringShellPropertiesTests.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2021-2023 the original author or authors.
2+
* Copyright 2021-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -38,8 +38,8 @@ public void defaultNoPropertiesSet() {
3838
assertThat(properties.getHistory().getName()).isNull();
3939
assertThat(properties.getConfig().getLocation()).isNull();
4040
assertThat(properties.getConfig().getEnv()).isNull();
41-
assertThat(properties.getScript().isEnabled()).isTrue();
42-
assertThat(properties.getInteractive().isEnabled()).isTrue();
41+
assertThat(properties.getScript().isEnabled()).isFalse();
42+
assertThat(properties.getInteractive().isEnabled()).isFalse();
4343
assertThat(properties.getNoninteractive().isEnabled()).isTrue();
4444
assertThat(properties.getNoninteractive().getPrimaryCommand()).isNull();
4545
assertThat(properties.getTheme().getName()).isNull();
@@ -81,8 +81,8 @@ public void setProperties() {
8181
.withPropertyValues("spring.shell.history.name=fakename")
8282
.withPropertyValues("spring.shell.config.location=fakelocation")
8383
.withPropertyValues("spring.shell.config.env=FAKE_ENV")
84-
.withPropertyValues("spring.shell.script.enabled=false")
85-
.withPropertyValues("spring.shell.interactive.enabled=false")
84+
.withPropertyValues("spring.shell.script.enabled=true")
85+
.withPropertyValues("spring.shell.interactive.enabled=true")
8686
.withPropertyValues("spring.shell.noninteractive.enabled=false")
8787
.withPropertyValues("spring.shell.noninteractive.primary-command=fakecommand")
8888
.withPropertyValues("spring.shell.theme.name=fake")
@@ -121,8 +121,8 @@ public void setProperties() {
121121
assertThat(properties.getHistory().getName()).isEqualTo("fakename");
122122
assertThat(properties.getConfig().getLocation()).isEqualTo("fakelocation");
123123
assertThat(properties.getConfig().getEnv()).isEqualTo("FAKE_ENV");
124-
assertThat(properties.getScript().isEnabled()).isFalse();
125-
assertThat(properties.getInteractive().isEnabled()).isFalse();
124+
assertThat(properties.getScript().isEnabled()).isTrue();
125+
assertThat(properties.getInteractive().isEnabled()).isTrue();
126126
assertThat(properties.getNoninteractive().isEnabled()).isFalse();
127127
assertThat(properties.getNoninteractive().getPrimaryCommand()).isEqualTo("fakecommand");
128128
assertThat(properties.getTheme().getName()).isEqualTo("fake");

spring-shell-samples/spring-shell-sample-commands/src/main/resources/application.yml

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ spring:
22
main:
33
banner-mode: off
44
shell:
5+
script:
6+
enabled: true
57
interactive:
68
enabled: true
79
## pick global default option naming

spring-shell-samples/spring-shell-sample-e2e/src/main/resources/application.yml

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ spring:
22
main:
33
banner-mode: off
44
shell:
5+
script:
6+
enabled: true
57
interactive:
68
enabled: true
79
## pick global default option naming

0 commit comments

Comments
 (0)