This commit is contained in:
Phillip Webb
2018-10-29 14:23:35 -07:00
parent ac9c003a65
commit f3fa20b2d1
24 changed files with 281 additions and 79 deletions

View File

@@ -23,7 +23,6 @@ import javax.servlet.Filter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
@@ -108,11 +107,15 @@ public class RemoteDevToolsAutoConfiguration {
@ConditionalOnProperty(prefix = "spring.devtools.remote.restart", name = "enabled", matchIfMissing = true)
static class RemoteRestartConfiguration {
@Autowired
private DevToolsProperties properties;
private final DevToolsProperties properties;
@Autowired
private ServerProperties serverProperties;
private final ServerProperties serverProperties;
RemoteRestartConfiguration(DevToolsProperties devToolsProperties,
ServerProperties serverProperties) {
this.properties = devToolsProperties;
this.serverProperties = serverProperties;
}
@Bean
@ConditionalOnMissingBean

View File

@@ -0,0 +1,20 @@
/*
* Copyright 2012-2018 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.
*/
/**
* Devtools specific logging concerns.
*/
package org.springframework.boot.devtools.logger;

View File

@@ -28,7 +28,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
@@ -75,11 +75,12 @@ public class RemoteClientConfiguration implements InitializingBean {
private final DevToolsProperties properties;
@Value("${remoteUrl}")
private String remoteUrl;
private final String remoteUrl;
public RemoteClientConfiguration(DevToolsProperties properties) {
public RemoteClientConfiguration(DevToolsProperties properties,
@Value("${remoteUrl}") String remoteUrl) {
this.properties = properties;
this.remoteUrl = remoteUrl;
}
@Bean
@@ -134,20 +135,25 @@ public class RemoteClientConfiguration implements InitializingBean {
static class LiveReloadConfiguration
implements ApplicationListener<ClassPathChangedEvent> {
@Autowired
private DevToolsProperties properties;
private final DevToolsProperties properties;
@Autowired(required = false)
private LiveReloadServer liveReloadServer;
private final LiveReloadServer liveReloadServer;
@Autowired
private ClientHttpRequestFactory clientHttpRequestFactory;
private final ClientHttpRequestFactory clientHttpRequestFactory;
@Value("${remoteUrl}")
private String remoteUrl;
private ExecutorService executor = Executors.newSingleThreadExecutor();
LiveReloadConfiguration(DevToolsProperties properties,
ObjectProvider<LiveReloadServer> liveReloadServer,
ClientHttpRequestFactory clientHttpRequestFactory) {
this.properties = properties;
this.liveReloadServer = liveReloadServer.getIfAvailable();
this.clientHttpRequestFactory = clientHttpRequestFactory;
}
@Bean
@RestartScope
@ConditionalOnMissingBean
@@ -181,11 +187,15 @@ public class RemoteClientConfiguration implements InitializingBean {
@ConditionalOnProperty(prefix = "spring.devtools.remote.restart", name = "enabled", matchIfMissing = true)
static class RemoteRestartClientConfiguration {
@Autowired
private DevToolsProperties properties;
private final DevToolsProperties properties;
@Value("${remoteUrl}")
private String remoteUrl;
private final String remoteUrl;
RemoteRestartClientConfiguration(DevToolsProperties properties,
@Value("${remoteUrl}") String remoteUrl) {
this.properties = properties;
this.remoteUrl = remoteUrl;
}
@Bean
public ClassPathFileSystemWatcher classPathFileSystemWatcher() {