Skip to content

Commit dd4dbce

Browse files
committed
Fix generation of Javadoc on Java 9
This commit fixes Javadoc generation when building with Java 9. It upgrades the Javadoc plugin to a version that is Java 9 compatible (3.0.0-M1) and reworks DevTools to remove usage of @PostConstruct. The latter change is necessary as @PostConstruct is not visible by default when building with Java 9 and, therefore its usage causes Javadoc generation to fail. Closes gh-10029
1 parent 43ff84e commit dd4dbce

File tree

5 files changed

+26
-22
lines changed

5 files changed

+26
-22
lines changed

spring-boot-dependencies/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@
217217
<maven-invoker-plugin.version>3.0.0</maven-invoker-plugin.version>
218218
<maven-help-plugin.version>2.2</maven-help-plugin.version>
219219
<maven-jar-plugin.version>3.0.2</maven-jar-plugin.version>
220-
<maven-javadoc-plugin.version>2.10.4</maven-javadoc-plugin.version>
220+
<maven-javadoc-plugin.version>3.0.0-M1</maven-javadoc-plugin.version>
221221
<maven-resources-plugin.version>3.0.1</maven-resources-plugin.version>
222222
<maven-shade-plugin.version>2.4.3</maven-shade-plugin.version>
223223
<maven-site-plugin.version>3.5.1</maven-site-plugin.version>

spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/HateoasObjenesisCacheDisabler.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,10 @@
1818

1919
import java.lang.reflect.Field;
2020

21-
import javax.annotation.PostConstruct;
22-
2321
import org.apache.commons.logging.Log;
2422
import org.apache.commons.logging.LogFactory;
2523

24+
import org.springframework.beans.factory.InitializingBean;
2625
import org.springframework.util.ClassUtils;
2726
import org.springframework.util.ReflectionUtils;
2827

@@ -35,22 +34,26 @@
3534
* @author Andy Wilkinson
3635
* @since 1.3.0
3736
*/
38-
class HateoasObjenesisCacheDisabler {
37+
class HateoasObjenesisCacheDisabler implements InitializingBean {
3938

4039
private static final Log logger = LogFactory
4140
.getLog(HateoasObjenesisCacheDisabler.class);
4241

4342
private static boolean cacheDisabled;
4443

45-
@PostConstruct
46-
void disableCaching() {
44+
@Override
45+
public void afterPropertiesSet() {
46+
disableCaching();
47+
}
48+
49+
private void disableCaching() {
4750
if (!cacheDisabled) {
4851
cacheDisabled = true;
4952
doDisableCaching();
5053
}
5154
}
5255

53-
void doDisableCaching() {
56+
private void doDisableCaching() {
5457
try {
5558
Class<?> type = ClassUtils.forName(
5659
"org.springframework.hateoas.core.DummyInvocationUtils",

spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/OptionalLiveReloadServer.java

Lines changed: 9 additions & 10 deletions
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.
@@ -16,11 +16,10 @@
1616

1717
package org.springframework.boot.devtools.autoconfigure;
1818

19-
import javax.annotation.PostConstruct;
20-
2119
import org.apache.commons.logging.Log;
2220
import org.apache.commons.logging.LogFactory;
2321

22+
import org.springframework.beans.factory.InitializingBean;
2423
import org.springframework.boot.devtools.livereload.LiveReloadServer;
2524

2625
/**
@@ -30,7 +29,7 @@
3029
* @author Phillip Webb
3130
* @since 1.3.0
3231
*/
33-
public class OptionalLiveReloadServer {
32+
public class OptionalLiveReloadServer implements InitializingBean {
3433

3534
private static final Log logger = LogFactory.getLog(OptionalLiveReloadServer.class);
3635

@@ -44,12 +43,12 @@ public OptionalLiveReloadServer(LiveReloadServer server) {
4443
this.server = server;
4544
}
4645

47-
/**
48-
* {@link PostConstruct} method to start the server if possible.
49-
* @throws Exception in case of errors
50-
*/
51-
@PostConstruct
52-
public void startServer() throws Exception {
46+
@Override
47+
public void afterPropertiesSet() throws Exception {
48+
startServer();
49+
}
50+
51+
void startServer() throws Exception {
5352
if (this.server != null) {
5453
try {
5554
if (!this.server.isStarted()) {

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@
2424
import java.util.concurrent.ExecutorService;
2525
import java.util.concurrent.Executors;
2626

27-
import javax.annotation.PostConstruct;
28-
2927
import org.apache.commons.logging.Log;
3028
import org.apache.commons.logging.LogFactory;
3129

30+
import org.springframework.beans.factory.InitializingBean;
3231
import org.springframework.beans.factory.annotation.Autowired;
3332
import org.springframework.beans.factory.annotation.Value;
3433
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
@@ -70,7 +69,7 @@
7069
*/
7170
@Configuration
7271
@EnableConfigurationProperties(DevToolsProperties.class)
73-
public class RemoteClientConfiguration {
72+
public class RemoteClientConfiguration implements InitializingBean {
7473

7574
private static final Log logger = LogFactory.getLog(RemoteClientConfiguration.class);
7675

@@ -111,7 +110,10 @@ private ClientHttpRequestInterceptor getSecurityInterceptor() {
111110
return new HttpHeaderInterceptor(secretHeaderName, secret);
112111
}
113112

114-
@PostConstruct
113+
public void afterPropertiesSet() {
114+
logWarnings();
115+
}
116+
115117
private void logWarnings() {
116118
RemoteDevToolsProperties remoteProperties = this.properties.getRemote();
117119
if (!remoteProperties.getRestart().isEnabled()) {

spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/HateoasObjenesisCacheDisablerTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public void cacheIsEnabledByDefault() {
5555

5656
@Test
5757
public void cacheIsDisabled() {
58-
new HateoasObjenesisCacheDisabler().doDisableCaching();
58+
new HateoasObjenesisCacheDisabler().afterPropertiesSet();
5959
assertThat(this.objenesis.getInstantiatorOf(TestObject.class))
6060
.isNotSameAs(this.objenesis.getInstantiatorOf(TestObject.class));
6161
}

0 commit comments

Comments
 (0)