diff --git a/spring-boot-dependencies/pom.xml b/spring-boot-dependencies/pom.xml index 53925a7aa15..8cfbe9fcb3b 100644 --- a/spring-boot-dependencies/pom.xml +++ b/spring-boot-dependencies/pom.xml @@ -217,7 +217,7 @@ 3.0.0 2.2 3.0.2 - 2.10.4 + 3.0.0-M1 3.0.1 2.4.3 3.5.1 diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/HateoasObjenesisCacheDisabler.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/HateoasObjenesisCacheDisabler.java index 23a2714c9b9..919277aa677 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/HateoasObjenesisCacheDisabler.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/HateoasObjenesisCacheDisabler.java @@ -18,11 +18,10 @@ package org.springframework.boot.devtools.autoconfigure; import java.lang.reflect.Field; -import javax.annotation.PostConstruct; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.InitializingBean; import org.springframework.util.ClassUtils; import org.springframework.util.ReflectionUtils; @@ -35,22 +34,26 @@ import org.springframework.util.ReflectionUtils; * @author Andy Wilkinson * @since 1.3.0 */ -class HateoasObjenesisCacheDisabler { +class HateoasObjenesisCacheDisabler implements InitializingBean { private static final Log logger = LogFactory .getLog(HateoasObjenesisCacheDisabler.class); private static boolean cacheDisabled; - @PostConstruct - void disableCaching() { + @Override + public void afterPropertiesSet() { + disableCaching(); + } + + private void disableCaching() { if (!cacheDisabled) { cacheDisabled = true; doDisableCaching(); } } - void doDisableCaching() { + private void doDisableCaching() { try { Class type = ClassUtils.forName( "org.springframework.hateoas.core.DummyInvocationUtils", diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/OptionalLiveReloadServer.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/OptionalLiveReloadServer.java index ac77c8b9356..5474f4f6110 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/OptionalLiveReloadServer.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/OptionalLiveReloadServer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2017 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. @@ -16,11 +16,10 @@ package org.springframework.boot.devtools.autoconfigure; -import javax.annotation.PostConstruct; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.InitializingBean; import org.springframework.boot.devtools.livereload.LiveReloadServer; /** @@ -30,7 +29,7 @@ import org.springframework.boot.devtools.livereload.LiveReloadServer; * @author Phillip Webb * @since 1.3.0 */ -public class OptionalLiveReloadServer { +public class OptionalLiveReloadServer implements InitializingBean { private static final Log logger = LogFactory.getLog(OptionalLiveReloadServer.class); @@ -44,12 +43,12 @@ public class OptionalLiveReloadServer { this.server = server; } - /** - * {@link PostConstruct} method to start the server if possible. - * @throws Exception in case of errors - */ - @PostConstruct - public void startServer() throws Exception { + @Override + public void afterPropertiesSet() throws Exception { + startServer(); + } + + void startServer() throws Exception { if (this.server != null) { try { if (!this.server.isStarted()) { diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/client/RemoteClientConfiguration.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/client/RemoteClientConfiguration.java index 81d1e92b51f..2b099215891 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/client/RemoteClientConfiguration.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/client/RemoteClientConfiguration.java @@ -24,11 +24,10 @@ import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import javax.annotation.PostConstruct; - 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.annotation.Value; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; @@ -70,7 +69,7 @@ import org.springframework.util.StringUtils; */ @Configuration @EnableConfigurationProperties(DevToolsProperties.class) -public class RemoteClientConfiguration { +public class RemoteClientConfiguration implements InitializingBean { private static final Log logger = LogFactory.getLog(RemoteClientConfiguration.class); @@ -111,7 +110,10 @@ public class RemoteClientConfiguration { return new HttpHeaderInterceptor(secretHeaderName, secret); } - @PostConstruct + public void afterPropertiesSet() { + logWarnings(); + } + private void logWarnings() { RemoteDevToolsProperties remoteProperties = this.properties.getRemote(); if (!remoteProperties.getRestart().isEnabled()) { diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/HateoasObjenesisCacheDisablerTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/HateoasObjenesisCacheDisablerTests.java index f0066aa41d4..636a701d665 100644 --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/HateoasObjenesisCacheDisablerTests.java +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/HateoasObjenesisCacheDisablerTests.java @@ -55,7 +55,7 @@ public class HateoasObjenesisCacheDisablerTests { @Test public void cacheIsDisabled() { - new HateoasObjenesisCacheDisabler().doDisableCaching(); + new HateoasObjenesisCacheDisabler().afterPropertiesSet(); assertThat(this.objenesis.getInstantiatorOf(TestObject.class)) .isNotSameAs(this.objenesis.getInstantiatorOf(TestObject.class)); }