Skip to content

Commit 16fcbb7

Browse files
committed
Remove Devtools remote debugging support
See gh-9489
1 parent 88e3b0f commit 16fcbb7

16 files changed

+11
-512
lines changed

Diff for: spring-boot-devtools/src/main/java/org/springframework/boot/devtools/RemoteSpringApplication.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,9 @@
3838

3939
/**
4040
* Application that can be used to establish a link to remotely running Spring Boot code.
41-
* Allows remote debugging and remote updates (if enabled). This class should be launched
42-
* from within your IDE and should have the same classpath configuration as the locally
43-
* developed application. The remote URL of the application should be provided as a
44-
* non-option argument.
41+
* Allows remote updates (if enabled). This class should be launched from within your IDE
42+
* and should have the same classpath configuration as the locally developed application.
43+
* The remote URL of the application should be provided as a non-option argument.
4544
*
4645
* @author Phillip Webb
4746
* @since 1.3.0

Diff for: spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/RemoteDevToolsAutoConfiguration.java

-38
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import org.apache.commons.logging.LogFactory;
2525

2626
import org.springframework.beans.factory.annotation.Autowired;
27-
import org.springframework.beans.factory.annotation.Qualifier;
2827
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
2928
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
3029
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
@@ -45,10 +44,6 @@
4544
import org.springframework.boot.devtools.restart.server.HttpRestartServer;
4645
import org.springframework.boot.devtools.restart.server.HttpRestartServerHandler;
4746
import org.springframework.boot.devtools.restart.server.SourceFolderUrlFilter;
48-
import org.springframework.boot.devtools.tunnel.server.HttpTunnelServer;
49-
import org.springframework.boot.devtools.tunnel.server.HttpTunnelServerHandler;
50-
import org.springframework.boot.devtools.tunnel.server.RemoteDebugPortProvider;
51-
import org.springframework.boot.devtools.tunnel.server.SocketTargetServerConnection;
5247
import org.springframework.context.annotation.Bean;
5348
import org.springframework.context.annotation.Configuration;
5449
import org.springframework.core.annotation.Order;
@@ -148,39 +143,6 @@ public UrlHandlerMapper remoteRestartHandlerMapper(HttpRestartServer server) {
148143

149144
}
150145

151-
/**
152-
* Configuration for remote debug HTTP tunneling.
153-
*/
154-
@ConditionalOnProperty(prefix = "spring.devtools.remote.debug", name = "enabled", matchIfMissing = true)
155-
static class RemoteDebugTunnelConfiguration {
156-
157-
@Autowired
158-
private DevToolsProperties properties;
159-
160-
@Autowired
161-
private ServerProperties serverProperties;
162-
163-
@Bean
164-
@ConditionalOnMissingBean(name = "remoteDebugHandlerMapper")
165-
public UrlHandlerMapper remoteDebugHandlerMapper(
166-
@Qualifier("remoteDebugHttpTunnelServer") HttpTunnelServer server) {
167-
String url = (this.serverProperties.getServlet().getContextPath() == null ? ""
168-
: this.serverProperties.getServlet().getContextPath())
169-
+ this.properties.getRemote().getContextPath() + "/debug";
170-
logger.warn("Listening for remote debug traffic on " + url);
171-
Handler handler = new HttpTunnelServerHandler(server);
172-
return new UrlHandlerMapper(url, handler);
173-
}
174-
175-
@Bean
176-
@ConditionalOnMissingBean(name = "remoteDebugHttpTunnelServer")
177-
public HttpTunnelServer remoteDebugHttpTunnelServer() {
178-
return new HttpTunnelServer(
179-
new SocketTargetServerConnection(new RemoteDebugPortProvider()));
180-
}
181-
182-
}
183-
184146
@Configuration
185147
@ConditionalOnClass(WebSecurityConfigurerAdapter.class)
186148
@ConditionalOnBean(ObjectPostProcessor.class)

Diff for: spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/RemoteDevToolsProperties.java

+1-39
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2015 the original author or authors.
2+
* Copyright 2012-2017 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.
@@ -48,8 +48,6 @@ public class RemoteDevToolsProperties {
4848

4949
private Restart restart = new Restart();
5050

51-
private Debug debug = new Debug();
52-
5351
private Proxy proxy = new Proxy();
5452

5553
public String getContextPath() {
@@ -80,10 +78,6 @@ public Restart getRestart() {
8078
return this.restart;
8179
}
8280

83-
public Debug getDebug() {
84-
return this.debug;
85-
}
86-
8781
public Proxy getProxy() {
8882
return this.proxy;
8983
}
@@ -105,38 +99,6 @@ public void setEnabled(boolean enabled) {
10599

106100
}
107101

108-
public static class Debug {
109-
110-
public static final Integer DEFAULT_LOCAL_PORT = 8000;
111-
112-
/**
113-
* Enable remote debug support.
114-
*/
115-
private boolean enabled = true;
116-
117-
/**
118-
* Local remote debug server port.
119-
*/
120-
private int localPort = DEFAULT_LOCAL_PORT;
121-
122-
public boolean isEnabled() {
123-
return this.enabled;
124-
}
125-
126-
public void setEnabled(boolean enabled) {
127-
this.enabled = enabled;
128-
}
129-
130-
public int getLocalPort() {
131-
return this.localPort;
132-
}
133-
134-
public void setLocalPort(int localPort) {
135-
this.localPort = localPort;
136-
}
137-
138-
}
139-
140102
public static class Proxy {
141103

142104
/**

Diff for: spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/client/LocalDebugPortAvailableCondition.java

-60
This file was deleted.

Diff for: spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/client/LoggingTunnelClientListener.java

-46
This file was deleted.

Diff for: spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/client/RemoteClientConfiguration.java

+3-38
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2016 the original author or authors.
2+
* Copyright 2012-2017 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.
@@ -25,14 +25,12 @@
2525
import java.util.concurrent.Executors;
2626

2727
import javax.annotation.PostConstruct;
28-
import javax.servlet.Filter;
2928

3029
import org.apache.commons.logging.Log;
3130
import org.apache.commons.logging.LogFactory;
3231

3332
import org.springframework.beans.factory.annotation.Autowired;
3433
import org.springframework.beans.factory.annotation.Value;
35-
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
3634
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
3735
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
3836
import org.springframework.boot.context.properties.EnableConfigurationProperties;
@@ -52,11 +50,7 @@
5250
import org.springframework.boot.devtools.restart.DefaultRestartInitializer;
5351
import org.springframework.boot.devtools.restart.RestartScope;
5452
import org.springframework.boot.devtools.restart.Restarter;
55-
import org.springframework.boot.devtools.tunnel.client.HttpTunnelConnection;
56-
import org.springframework.boot.devtools.tunnel.client.TunnelClient;
57-
import org.springframework.boot.devtools.tunnel.client.TunnelConnection;
5853
import org.springframework.context.annotation.Bean;
59-
import org.springframework.context.annotation.Conditional;
6054
import org.springframework.context.annotation.Configuration;
6155
import org.springframework.context.event.EventListener;
6256
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
@@ -120,9 +114,8 @@ private ClientHttpRequestInterceptor getSecurityInterceptor() {
120114
@PostConstruct
121115
private void logWarnings() {
122116
RemoteDevToolsProperties remoteProperties = this.properties.getRemote();
123-
if (!remoteProperties.getDebug().isEnabled()
124-
&& !remoteProperties.getRestart().isEnabled()) {
125-
logger.warn("Remote restart and debug are both disabled.");
117+
if (!remoteProperties.getRestart().isEnabled()) {
118+
logger.warn("Remote restart is disabled.");
126119
}
127120
if (!this.remoteUrl.startsWith("https://")) {
128121
logger.warn("The connection to " + this.remoteUrl
@@ -239,32 +232,4 @@ public ClassPathChangeUploader classPathChangeUploader(
239232

240233
}
241234

242-
/**
243-
* Client configuration for remote debug HTTP tunneling.
244-
*/
245-
@ConditionalOnProperty(prefix = "spring.devtools.remote.debug", name = "enabled", matchIfMissing = true)
246-
@ConditionalOnClass(Filter.class)
247-
@Conditional(LocalDebugPortAvailableCondition.class)
248-
static class RemoteDebugTunnelClientConfiguration {
249-
250-
@Autowired
251-
private DevToolsProperties properties;
252-
253-
@Value("${remoteUrl}")
254-
private String remoteUrl;
255-
256-
@Bean
257-
public TunnelClient remoteDebugTunnelClient(
258-
ClientHttpRequestFactory requestFactory) {
259-
RemoteDevToolsProperties remoteProperties = this.properties.getRemote();
260-
String url = this.remoteUrl + remoteProperties.getContextPath() + "/debug";
261-
TunnelConnection connection = new HttpTunnelConnection(url, requestFactory);
262-
int localPort = remoteProperties.getDebug().getLocalPort();
263-
TunnelClient client = new TunnelClient(localPort, connection);
264-
client.addListener(new LoggingTunnelClientListener());
265-
return client;
266-
}
267-
268-
}
269-
270235
}

Diff for: spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/client/HttpTunnelConnection.java

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2016 the original author or authors.
2+
* Copyright 2012-2017 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.
@@ -196,12 +196,6 @@ private void handleResponse(ClientHttpResponse response) throws IOException {
196196
close();
197197
return;
198198
}
199-
if (response.getStatusCode() == HttpStatus.SERVICE_UNAVAILABLE) {
200-
logger.warn("Remote application responded with service unavailable. Did "
201-
+ "you forget to start it with remote debugging enabled?");
202-
close();
203-
return;
204-
}
205199
if (response.getStatusCode() == HttpStatus.OK) {
206200
HttpTunnelPayload payload = HttpTunnelPayload.get(response);
207201
if (payload != null) {

Diff for: spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServer.java

-3
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,6 @@ protected void handle(HttpConnection httpConnection) throws IOException {
158158
catch (ConnectException ex) {
159159
httpConnection.respond(HttpStatus.GONE);
160160
}
161-
catch (RemoteDebugNotRunningException ex) {
162-
httpConnection.respond(HttpStatus.SERVICE_UNAVAILABLE);
163-
}
164161
}
165162

166163
/**

Diff for: spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/server/RemoteDebugNotRunningException.java

-26
This file was deleted.

0 commit comments

Comments
 (0)