From cfee9bab817bd6bce5e14aea13f42f3128bc3df5 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Tue, 11 Oct 2016 17:39:28 +0200 Subject: [PATCH] Deprecate remote shell support Closes gh-7044 --- .../autoconfigure/CrshAutoConfiguration.java | 1 + .../autoconfigure/ShellProperties.java | 1 + .../CrshAutoConfigurationTests.java | 1 + .../autoconfigure/ShellPropertiesTests.java | 1 + .../asciidoc/production-ready-features.adoc | 2 +- .../spring-boot-starter-remote-shell/pom.xml | 4 +- ...terDeprecatedWarningAutoConfiguration.java | 49 +++++++++++++++++++ .../main/resources/META-INF/spring.factories | 2 + 8 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 spring-boot-starters/spring-boot-starter-remote-shell/src/main/java/org/springframework/boot/starter/remote/shell/RemoteShellStarterDeprecatedWarningAutoConfiguration.java create mode 100644 spring-boot-starters/spring-boot-starter-remote-shell/src/main/resources/META-INF/spring.factories diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfiguration.java index 319a11e27a..6e167535ba 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfiguration.java @@ -121,6 +121,7 @@ import org.springframework.util.StringUtils; @EnableConfigurationProperties(ShellProperties.class) @AutoConfigureAfter({ SecurityAutoConfiguration.class, ManagementWebSecurityAutoConfiguration.class }) +@Deprecated public class CrshAutoConfiguration { public static final String AUTH_PREFIX = ShellProperties.SHELL_PREFIX + ".auth"; diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ShellProperties.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ShellProperties.java index 9852788b1e..d0de4dcc91 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ShellProperties.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ShellProperties.java @@ -40,6 +40,7 @@ import org.springframework.util.StringUtils; * @author Stephane Nicoll */ @ConfigurationProperties(prefix = ShellProperties.SHELL_PREFIX, ignoreUnknownFields = true) +@Deprecated public class ShellProperties { public static final String SHELL_PREFIX = "management.shell"; diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfigurationTests.java index 2b4cb7089e..764605e0bd 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfigurationTests.java @@ -68,6 +68,7 @@ import static org.hamcrest.CoreMatchers.isA; * @author Stephane Nicoll */ @SuppressWarnings({ "rawtypes", "unchecked" }) +@Deprecated public class CrshAutoConfigurationTests { private AnnotationConfigWebApplicationContext context; diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ShellPropertiesTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ShellPropertiesTests.java index 577265879d..1bdd66ce28 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ShellPropertiesTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ShellPropertiesTests.java @@ -49,6 +49,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Christian Dupuis * @author Stephane Nicoll */ +@Deprecated public class ShellPropertiesTests { @Rule diff --git a/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc b/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc index 19c05edeea..5e47bb167c 100644 --- a/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc +++ b/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc @@ -803,7 +803,7 @@ If you are using Jolokia but you don't want Spring Boot to configure it, simply [[production-ready-remote-shell]] -== Monitoring and management using a remote shell +== Monitoring and management using a remote shell (deprecated) Spring Boot supports an integrated Java shell called '`CRaSH`'. You can use CRaSH to `ssh` or `telnet` into your running application. To enable remote shell support, add the following dependency to your project: diff --git a/spring-boot-starters/spring-boot-starter-remote-shell/pom.xml b/spring-boot-starters/spring-boot-starter-remote-shell/pom.xml index 18763b42d2..6b17f1e410 100644 --- a/spring-boot-starters/spring-boot-starter-remote-shell/pom.xml +++ b/spring-boot-starters/spring-boot-starter-remote-shell/pom.xml @@ -7,9 +7,9 @@ 1.5.0.BUILD-SNAPSHOT spring-boot-starter-remote-shell - Spring Boot Remote Shell Starter + spring-boot-starter-remote-shell (DEPRECATED) Starter for using the CRaSH remote shell to monitor and manage your - application over SSH + application over SSH. Deprecated since 1.5 http://projects.spring.io/spring-boot/ Pivotal Software, Inc. diff --git a/spring-boot-starters/spring-boot-starter-remote-shell/src/main/java/org/springframework/boot/starter/remote/shell/RemoteShellStarterDeprecatedWarningAutoConfiguration.java b/spring-boot-starters/spring-boot-starter-remote-shell/src/main/java/org/springframework/boot/starter/remote/shell/RemoteShellStarterDeprecatedWarningAutoConfiguration.java new file mode 100644 index 0000000000..acb14e8702 --- /dev/null +++ b/spring-boot-starters/spring-boot-starter-remote-shell/src/main/java/org/springframework/boot/starter/remote/shell/RemoteShellStarterDeprecatedWarningAutoConfiguration.java @@ -0,0 +1,49 @@ +/* + * Copyright 2012-2016 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.starter.remote.shell; + +import javax.annotation.PostConstruct; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.context.annotation.Configuration; + +/** + * {@link EnableAutoConfiguration Auto-configuration} to print a deprecation warning about + * the starter. + * + * @author Stephane Nicoll + * @since 1.4.0 + */ +@Configuration +@Deprecated +public class RemoteShellStarterDeprecatedWarningAutoConfiguration { + + private static final Log logger = LogFactory + .getLog(RemoteShellStarterDeprecatedWarningAutoConfiguration.class); + + @PostConstruct + public void logWarning() { + logger.warn("spring-boot-starter-remote-shell is deprecated since Spring Boot " + + "1.5 and will be removed in Spring Boot 2.0"); + } + +} + + diff --git a/spring-boot-starters/spring-boot-starter-remote-shell/src/main/resources/META-INF/spring.factories b/spring-boot-starters/spring-boot-starter-remote-shell/src/main/resources/META-INF/spring.factories new file mode 100644 index 0000000000..aa178205ab --- /dev/null +++ b/spring-boot-starters/spring-boot-starter-remote-shell/src/main/resources/META-INF/spring.factories @@ -0,0 +1,2 @@ +org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ +org.springframework.boot.starter.remote.shell.RemoteShellStarterDeprecatedWarningAutoConfiguration \ No newline at end of file