getAll() {
- synchronized (this.monitor) {
- return Collections.unmodifiableMap(new LinkedHashMap<>(this.healthIndicators));
- }
- }
-
-}
diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthAggregator.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthAggregator.java
deleted file mode 100644
index 3049fe742b..0000000000
--- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthAggregator.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2012-2019 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
- *
- * https://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.actuate.health;
-
-import java.util.Map;
-
-/**
- * Strategy interface used to aggregate {@link Health} instances into a final one.
- *
- * This is especially useful to combine subsystem states expressed through
- * {@link Health#getStatus()} into one state for the entire system. The default
- * implementation {@link OrderedHealthAggregator} sorts {@link Status} instances based on
- * a priority list.
- *
- * It is possible to add more complex {@link Status} types to the system. In that case
- * either the {@link OrderedHealthAggregator} needs to be properly configured or users
- * need to register a custom {@link HealthAggregator} as bean.
- *
- * @author Christian Dupuis
- * @since 1.1.0
- * @deprecated since 2.2.0 in favor of {@link StatusAggregator}
- */
-@FunctionalInterface
-@Deprecated
-public interface HealthAggregator {
-
- /**
- * Aggregate several given {@link Health} instances into one.
- * @param healths the health instances to aggregate
- * @return the aggregated health
- */
- Health aggregate(Map healths);
-
-}
diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthEndpoint.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthEndpoint.java
index ce02cfabd9..c1c51d0d0b 100644
--- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthEndpoint.java
+++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthEndpoint.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -40,17 +40,6 @@ public class HealthEndpoint extends HealthEndpointSupport {
private final HealthEndpointGroups groups;
- /**
- * Throw a new {@link IllegalStateException} to indicate a constructor has been
- * deprecated.
- * @deprecated since 2.2.0 in order to support deprecated subclass constructors
- */
- @Deprecated
- HealthEndpointSupport() {
- throw new IllegalStateException("Unable to create " + getClass() + " using deprecated constructor");
- }
-
/**
* Create a new {@link HealthEndpointSupport} instance.
* @param registry the health contributor registry
diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthEndpointWebExtension.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthEndpointWebExtension.java
index 034faf3a89..9a44309af1 100644
--- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthEndpointWebExtension.java
+++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthEndpointWebExtension.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -45,17 +45,6 @@ public class HealthEndpointWebExtension extends HealthEndpointSupport
- * Implementations must be thread-safe.
- *
- * @author Andy Wilkinson
- * @author Vedran Pavic
- * @author Stephane Nicoll
- * @since 2.1.0
- * @see HealthEndpoint
- * @deprecated since 2.2.0 in favor of a {@link HealthContributorRegistry}
- */
-@Deprecated
-public interface HealthIndicatorRegistry {
-
- /**
- * Registers the given {@link HealthIndicator}, associating it with the given
- * {@code name}.
- * @param name the name of the indicator
- * @param healthIndicator the indicator
- * @throws IllegalStateException if the indicator cannot be registered with the given
- * {@code name}.
- */
- void register(String name, HealthIndicator healthIndicator);
-
- /**
- * Unregisters the {@link HealthIndicator} previously registered with the given
- * {@code name}.
- * @param name the name of the indicator
- * @return the unregistered indicator, or {@code null} if no indicator was found in
- * the registry for the given {@code name}.
- */
- HealthIndicator unregister(String name);
-
- /**
- * Returns the {@link HealthIndicator} registered with the given {@code name}.
- * @param name the name of the indicator
- * @return the health indicator, or {@code null} if no indicator was registered with
- * the given {@code name}.
- */
- HealthIndicator get(String name);
-
- /**
- * Returns a snapshot of the registered health indicators and their names. The
- * contents of the map do not reflect subsequent changes to the registry.
- * @return the snapshot of registered health indicators
- */
- Map getAll();
-
-}
diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthIndicatorRegistryFactory.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthIndicatorRegistryFactory.java
deleted file mode 100644
index 5a34072e90..0000000000
--- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthIndicatorRegistryFactory.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2012-2019 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
- *
- * https://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.actuate.health;
-
-import java.util.Map;
-import java.util.function.Function;
-
-import org.springframework.util.Assert;
-
-/**
- * Factory to create a {@link HealthIndicatorRegistry}.
- *
- * @author Stephane Nicoll
- * @since 2.1.0
- * @deprecated since 2.2.0 in favor of {@link DefaultHealthIndicatorRegistry}
- */
-@Deprecated
-public class HealthIndicatorRegistryFactory {
-
- private final Function healthIndicatorNameFactory;
-
- public HealthIndicatorRegistryFactory(Function healthIndicatorNameFactory) {
- this.healthIndicatorNameFactory = healthIndicatorNameFactory;
- }
-
- public HealthIndicatorRegistryFactory() {
- this(new HealthIndicatorNameFactory());
- }
-
- /**
- * Create a {@link HealthIndicatorRegistry} based on the specified health indicators.
- * @param healthIndicators the {@link HealthIndicator} instances mapped by name
- * @return a {@link HealthIndicator} that delegates to the specified
- * {@code healthIndicators}.
- */
- public HealthIndicatorRegistry createHealthIndicatorRegistry(Map healthIndicators) {
- Assert.notNull(healthIndicators, "HealthIndicators must not be null");
- return initialize(new DefaultHealthIndicatorRegistry(), healthIndicators);
- }
-
- protected T initialize(T registry,
- Map healthIndicators) {
- for (Map.Entry entry : healthIndicators.entrySet()) {
- String name = this.healthIndicatorNameFactory.apply(entry.getKey());
- registry.register(name, entry.getValue());
- }
- return registry;
- }
-
-}
diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthStatusHttpMapper.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthStatusHttpMapper.java
deleted file mode 100644
index c38793ef9b..0000000000
--- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthStatusHttpMapper.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright 2012-2019 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
- *
- * https://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.actuate.health;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.springframework.boot.actuate.endpoint.web.WebEndpointResponse;
-import org.springframework.util.Assert;
-
-/**
- * Map a {@link Status} to an HTTP status code.
- *
- * @author Stephane Nicoll
- * @since 2.0.0
- * @deprecated since 2.2.0 in favor of {@link HttpCodeStatusMapper} or
- * {@link SimpleHttpCodeStatusMapper}
- */
-@Deprecated
-public class HealthStatusHttpMapper {
-
- private Map statusMapping = new HashMap<>();
-
- /**
- * Create a new instance.
- */
- public HealthStatusHttpMapper() {
- setupDefaultStatusMapping();
- }
-
- private void setupDefaultStatusMapping() {
- addStatusMapping(Status.DOWN, WebEndpointResponse.STATUS_SERVICE_UNAVAILABLE);
- addStatusMapping(Status.OUT_OF_SERVICE, WebEndpointResponse.STATUS_SERVICE_UNAVAILABLE);
- }
-
- /**
- * Set specific status mappings.
- * @param statusMapping a map of health status code to HTTP status code
- */
- public void setStatusMapping(Map statusMapping) {
- Assert.notNull(statusMapping, "StatusMapping must not be null");
- this.statusMapping = new HashMap<>(statusMapping);
- }
-
- /**
- * Add specific status mappings to the existing set.
- * @param statusMapping a map of health status code to HTTP status code
- */
- public void addStatusMapping(Map statusMapping) {
- Assert.notNull(statusMapping, "StatusMapping must not be null");
- this.statusMapping.putAll(statusMapping);
- }
-
- /**
- * Add a status mapping to the existing set.
- * @param status the status to map
- * @param httpStatus the http status
- */
- public void addStatusMapping(Status status, Integer httpStatus) {
- Assert.notNull(status, "Status must not be null");
- Assert.notNull(httpStatus, "HttpStatus must not be null");
- addStatusMapping(status.getCode(), httpStatus);
- }
-
- /**
- * Add a status mapping to the existing set.
- * @param statusCode the status code to map
- * @param httpStatus the http status
- */
- public void addStatusMapping(String statusCode, Integer httpStatus) {
- Assert.notNull(statusCode, "StatusCode must not be null");
- Assert.notNull(httpStatus, "HttpStatus must not be null");
- this.statusMapping.put(statusCode, httpStatus);
- }
-
- /**
- * Return an immutable view of the status mapping.
- * @return the http status codes mapped by status name
- */
- public Map getStatusMapping() {
- return Collections.unmodifiableMap(this.statusMapping);
- }
-
- /**
- * Map the specified {@link Status} to an HTTP status code.
- * @param status the health {@link Status}
- * @return the corresponding HTTP status code
- */
- public int mapStatus(Status status) {
- String code = getUniformValue(status.getCode());
- if (code != null) {
- return this.statusMapping.entrySet().stream()
- .filter((entry) -> code.equals(getUniformValue(entry.getKey()))).map(Map.Entry::getValue)
- .findFirst().orElse(WebEndpointResponse.STATUS_OK);
- }
- return WebEndpointResponse.STATUS_OK;
- }
-
- private String getUniformValue(String code) {
- if (code == null) {
- return null;
- }
- StringBuilder builder = new StringBuilder();
- for (char ch : code.toCharArray()) {
- if (Character.isAlphabetic(ch) || Character.isDigit(ch)) {
- builder.append(Character.toLowerCase(ch));
- }
- }
- return builder.toString();
- }
-
-}
diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthWebEndpointResponseMapper.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthWebEndpointResponseMapper.java
deleted file mode 100644
index a6e8ec91d6..0000000000
--- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthWebEndpointResponseMapper.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright 2012-2019 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
- *
- * https://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.actuate.health;
-
-import java.security.Principal;
-import java.util.Set;
-import java.util.function.Supplier;
-
-import org.springframework.boot.actuate.endpoint.SecurityContext;
-import org.springframework.boot.actuate.endpoint.web.WebEndpointResponse;
-import org.springframework.security.core.Authentication;
-import org.springframework.security.core.GrantedAuthority;
-import org.springframework.util.ClassUtils;
-import org.springframework.util.CollectionUtils;
-
-/**
- * Maps a {@link Health} to a {@link WebEndpointResponse}.
- *
- * @author Andy Wilkinson
- * @since 2.0.0
- * @deprecated since 2.2.0 in favor of {@link HealthEndpointWebExtension} or
- * {@link ReactiveHealthEndpointWebExtension}
- */
-@Deprecated
-public class HealthWebEndpointResponseMapper {
-
- private final HealthStatusHttpMapper statusHttpMapper;
-
- private final ShowDetails showDetails;
-
- private final Set authorizedRoles;
-
- public HealthWebEndpointResponseMapper(HealthStatusHttpMapper statusHttpMapper, ShowDetails showDetails,
- Set authorizedRoles) {
- this.statusHttpMapper = statusHttpMapper;
- this.showDetails = showDetails;
- this.authorizedRoles = authorizedRoles;
- }
-
- /**
- * Maps the given {@code health} details to a {@link WebEndpointResponse}, honouring
- * the mapper's default {@link ShowDetails} using the given {@code securityContext}.
- *
- * If the current user does not have the right to see the details, the
- * {@link Supplier} is not invoked and a 404 response is returned instead.
- * @param health the provider of health details, invoked if the current user has the
- * right to see them
- * @param securityContext the security context
- * @return the mapped response
- */
- public WebEndpointResponse mapDetails(Supplier health, SecurityContext securityContext) {
- if (canSeeDetails(securityContext, this.showDetails)) {
- Health healthDetails = health.get();
- if (healthDetails != null) {
- return createWebEndpointResponse(healthDetails);
- }
- }
- return new WebEndpointResponse<>(WebEndpointResponse.STATUS_NOT_FOUND);
- }
-
- /**
- * Maps the given {@code health} to a {@link WebEndpointResponse}, honouring the
- * mapper's default {@link ShowDetails} using the given {@code securityContext}.
- * @param health the health to map
- * @param securityContext the security context
- * @return the mapped response
- */
- public WebEndpointResponse map(Health health, SecurityContext securityContext) {
- return map(health, securityContext, this.showDetails);
- }
-
- /**
- * Maps the given {@code health} to a {@link WebEndpointResponse}, honouring the given
- * {@code showDetails} using the given {@code securityContext}.
- * @param health the health to map
- * @param securityContext the security context
- * @param showDetails when to show details in the response
- * @return the mapped response
- */
- public WebEndpointResponse map(Health health, SecurityContext securityContext, ShowDetails showDetails) {
- if (!canSeeDetails(securityContext, showDetails)) {
- health = Health.status(health.getStatus()).build();
- }
- return createWebEndpointResponse(health);
- }
-
- private WebEndpointResponse createWebEndpointResponse(Health health) {
- int status = this.statusHttpMapper.mapStatus(health.getStatus());
- return new WebEndpointResponse<>(health, status);
- }
-
- private boolean canSeeDetails(SecurityContext securityContext, ShowDetails showDetails) {
- return showDetails != ShowDetails.NEVER && (showDetails != ShowDetails.WHEN_AUTHORIZED
- || (securityContext.getPrincipal() != null && isUserInRole(securityContext)));
- }
-
- private boolean isUserInRole(SecurityContext securityContext) {
- if (CollectionUtils.isEmpty(this.authorizedRoles)) {
- return true;
- }
- Principal principal = securityContext.getPrincipal();
- boolean checkAuthorities = isSpringSecurityAuthentication(principal);
- for (String role : this.authorizedRoles) {
- if (securityContext.isUserInRole(role)) {
- return true;
- }
- if (checkAuthorities) {
- Authentication authentication = (Authentication) principal;
- for (GrantedAuthority authority : authentication.getAuthorities()) {
- String name = authority.getAuthority();
- if (role.equals(name)) {
- return true;
- }
- }
- }
- }
-
- return false;
- }
-
- private boolean isSpringSecurityAuthentication(Principal principal) {
- return ClassUtils.isPresent("org.springframework.security.core.Authentication", null)
- && (principal instanceof Authentication);
- }
-
-}
diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/OrderedHealthAggregator.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/OrderedHealthAggregator.java
deleted file mode 100644
index a3396f56b7..0000000000
--- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/OrderedHealthAggregator.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright 2012-2020 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
- *
- * https://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.actuate.health;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.List;
-
-import org.springframework.util.Assert;
-
-/**
- * Default {@link HealthAggregator} implementation that aggregates {@link Health}
- * instances and determines the final system state based on a simple ordered list.
- *
- * If a different order is required or a new {@link Status} type will be used, the order
- * can be set by calling {@link #setStatusOrder(List)}.
- *
- * @author Christian Dupuis
- * @since 1.1.0
- * @deprecated since 2.2.0 in favor of {@link SimpleStatusAggregator}
- */
-@Deprecated
-public class OrderedHealthAggregator extends AbstractHealthAggregator {
-
- private List statusOrder;
-
- /**
- * Create a new {@link OrderedHealthAggregator} instance.
- */
- public OrderedHealthAggregator() {
- setStatusOrder(Status.DOWN, Status.OUT_OF_SERVICE, Status.UP, Status.UNKNOWN);
- }
-
- /**
- * Set the ordering of the status.
- * @param statusOrder an ordered list of the status
- */
- public void setStatusOrder(Status... statusOrder) {
- String[] order = new String[statusOrder.length];
- for (int i = 0; i < statusOrder.length; i++) {
- order[i] = statusOrder[i].getCode();
- }
- setStatusOrder(Arrays.asList(order));
- }
-
- /**
- * Set the ordering of the status.
- * @param statusOrder an ordered list of the status codes
- */
- public void setStatusOrder(List statusOrder) {
- Assert.notNull(statusOrder, "StatusOrder must not be null");
- this.statusOrder = statusOrder;
- }
-
- @Override
- protected Status aggregateStatus(List candidates) {
- // Only sort those status instances that we know about
- List filteredCandidates = new ArrayList<>();
- for (Status candidate : candidates) {
- if (this.statusOrder.contains(candidate.getCode())) {
- filteredCandidates.add(candidate);
- }
- }
- // If no status is given return UNKNOWN
- if (filteredCandidates.isEmpty()) {
- return Status.UNKNOWN;
- }
- // Sort given Status instances by configured order
- filteredCandidates.sort(new StatusComparator(this.statusOrder));
- return filteredCandidates.get(0);
- }
-
- /**
- * {@link Comparator} used to order {@link Status}.
- */
- private static class StatusComparator implements Comparator {
-
- private final List statusOrder;
-
- StatusComparator(List statusOrder) {
- this.statusOrder = statusOrder;
- }
-
- @Override
- public int compare(Status s1, Status s2) {
- int i1 = this.statusOrder.indexOf(s1.getCode());
- int i2 = this.statusOrder.indexOf(s2.getCode());
- return (i1 < i2) ? -1 : (i1 != i2) ? 1 : s1.getCode().compareTo(s2.getCode());
- }
-
- }
-
-}
diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ReactiveHealthContributor.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ReactiveHealthContributor.java
index 3bd7eb245a..89b4c3a148 100644
--- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ReactiveHealthContributor.java
+++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ReactiveHealthContributor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -31,7 +31,6 @@ import org.springframework.util.Assert;
*/
public interface ReactiveHealthContributor {
- @SuppressWarnings("deprecation")
static ReactiveHealthContributor adapt(HealthContributor healthContributor) {
Assert.notNull(healthContributor, "HealthContributor must not be null");
if (healthContributor instanceof HealthIndicator) {
diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ReactiveHealthEndpointWebExtension.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ReactiveHealthEndpointWebExtension.java
index a3d16e62c1..f5547ad4ae 100644
--- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ReactiveHealthEndpointWebExtension.java
+++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ReactiveHealthEndpointWebExtension.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -45,18 +45,6 @@ public class ReactiveHealthEndpointWebExtension
private static final String[] NO_PATH = {};
- /**
- * Create a new {@link ReactiveHealthEndpointWebExtension} instance.
- * @param delegate the delegate health indicator
- * @param responseMapper the response mapper
- * @deprecated since 2.2.0 in favor of
- * {@link #ReactiveHealthEndpointWebExtension(ReactiveHealthContributorRegistry, HealthEndpointGroups)}
- */
- @Deprecated
- public ReactiveHealthEndpointWebExtension(ReactiveHealthIndicator delegate,
- HealthWebEndpointResponseMapper responseMapper) {
- }
-
/**
* Create a new {@link ReactiveHealthEndpointWebExtension} instance.
* @param registry the health contributor registry
diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ReactiveHealthIndicatorRegistry.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ReactiveHealthIndicatorRegistry.java
deleted file mode 100644
index 7d3f68e36c..0000000000
--- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ReactiveHealthIndicatorRegistry.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 2012-2019 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
- *
- * https://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.actuate.health;
-
-import java.util.Map;
-
-/**
- * A registry of {@link ReactiveHealthIndicator ReactiveHealthIndicators}.
- *
- * Implementations must be thread-safe.
- *
- * @author Andy Wilkinson
- * @author Vedran Pavic
- * @author Stephane Nicoll
- * @since 2.1.0
- * @see HealthIndicatorRegistry
- * @deprecated since 2.2.0 in favor of a {@link ReactiveHealthContributorRegistry}
- */
-@Deprecated
-public interface ReactiveHealthIndicatorRegistry {
-
- /**
- * Registers the given {@link ReactiveHealthIndicator}, associating it with the given
- * {@code name}.
- * @param name the name of the indicator
- * @param healthIndicator the indicator
- * @throws IllegalStateException if an indicator with the given {@code name} is
- * already registered.
- */
- void register(String name, ReactiveHealthIndicator healthIndicator);
-
- /**
- * Unregisters the {@link ReactiveHealthIndicator} previously registered with the
- * given {@code name}.
- * @param name the name of the indicator
- * @return the unregistered indicator, or {@code null} if no indicator was found in
- * the registry for the given {@code name}.
- */
- ReactiveHealthIndicator unregister(String name);
-
- /**
- * Returns the {@link ReactiveHealthIndicator} registered with the given {@code name}.
- * @param name the name of the indicator
- * @return the health indicator, or {@code null} if no indicator was registered with
- * the given {@code name}.
- */
- ReactiveHealthIndicator get(String name);
-
- /**
- * Returns a snapshot of the registered health indicators and their names. The
- * contents of the map do not reflect subsequent changes to the registry.
- * @return the snapshot of registered health indicators
- */
- Map getAll();
-
-}
diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ReactiveHealthIndicatorRegistryFactory.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ReactiveHealthIndicatorRegistryFactory.java
deleted file mode 100644
index 9896104a13..0000000000
--- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ReactiveHealthIndicatorRegistryFactory.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright 2012-2019 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
- *
- * https://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.actuate.health;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.function.Function;
-
-import org.springframework.util.Assert;
-import org.springframework.util.ObjectUtils;
-
-/**
- * Factory to create a {@link HealthIndicatorRegistry}.
- *
- * @author Stephane Nicoll
- * @since 2.1.0
- * @deprecated since 2.2.0 in favor of {@link DefaultReactiveHealthIndicatorRegistry}
- */
-@Deprecated
-public class ReactiveHealthIndicatorRegistryFactory {
-
- private final Function healthIndicatorNameFactory;
-
- public ReactiveHealthIndicatorRegistryFactory(Function healthIndicatorNameFactory) {
- this.healthIndicatorNameFactory = healthIndicatorNameFactory;
- }
-
- public ReactiveHealthIndicatorRegistryFactory() {
- this(new HealthIndicatorNameFactory());
- }
-
- /**
- * Create a {@link ReactiveHealthIndicatorRegistry} based on the specified health
- * indicators. Each {@link HealthIndicator} are wrapped to a
- * {@link HealthIndicatorReactiveAdapter}. If two instances share the same name, the
- * reactive variant takes precedence.
- * @param reactiveHealthIndicators the {@link ReactiveHealthIndicator} instances
- * mapped by name
- * @param healthIndicators the {@link HealthIndicator} instances mapped by name if
- * any.
- * @return a {@link ReactiveHealthIndicator} that delegates to the specified
- * {@code reactiveHealthIndicators}.
- */
- public ReactiveHealthIndicatorRegistry createReactiveHealthIndicatorRegistry(
- Map reactiveHealthIndicators,
- Map healthIndicators) {
- Assert.notNull(reactiveHealthIndicators, "ReactiveHealthIndicators must not be null");
- return initialize(new DefaultReactiveHealthIndicatorRegistry(), reactiveHealthIndicators, healthIndicators);
- }
-
- protected T initialize(T registry,
- Map reactiveHealthIndicators,
- Map healthIndicators) {
- merge(reactiveHealthIndicators, healthIndicators).forEach((beanName, indicator) -> {
- String name = this.healthIndicatorNameFactory.apply(beanName);
- registry.register(name, indicator);
- });
- return registry;
- }
-
- private Map merge(Map reactiveHealthIndicators,
- Map healthIndicators) {
- if (ObjectUtils.isEmpty(healthIndicators)) {
- return reactiveHealthIndicators;
- }
- Map allIndicators = new LinkedHashMap<>(reactiveHealthIndicators);
- healthIndicators.forEach((beanName, indicator) -> {
- String name = this.healthIndicatorNameFactory.apply(beanName);
- allIndicators.computeIfAbsent(name, (n) -> new HealthIndicatorReactiveAdapter(indicator));
- });
- return allIndicators;
- }
-
-}
diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ShowDetails.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ShowDetails.java
deleted file mode 100644
index 30432741f5..0000000000
--- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ShowDetails.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2012-2019 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
- *
- * https://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.actuate.health;
-
-/**
- * Options for showing details in responses from the {@link HealthEndpoint} web
- * extensions.
- *
- * @author Andy Wilkinson
- * @since 2.0.0
- * @deprecated since 2.2.0 in favor of {@code HealthEndpointProperties.ShowDetails}
- */
-@Deprecated
-public enum ShowDetails {
-
- /**
- * Never show details in the response.
- */
- NEVER,
-
- /**
- * Show details in the response when accessed by an authorized user.
- */
- WHEN_AUTHORIZED,
-
- /**
- * Always show details in the response.
- */
- ALWAYS
-
-}
diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/MetricsClientHttpRequestInterceptor.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/MetricsClientHttpRequestInterceptor.java
index 1aeee033ad..e280b1e9d2 100644
--- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/MetricsClientHttpRequestInterceptor.java
+++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/MetricsClientHttpRequestInterceptor.java
@@ -53,20 +53,6 @@ class MetricsClientHttpRequestInterceptor implements ClientHttpRequestIntercepto
private final AutoTimer autoTimer;
- /**
- * Create a new {@code MetricsClientHttpRequestInterceptor}.
- * @param meterRegistry the registry to which metrics are recorded
- * @param tagProvider provider for metrics tags
- * @param metricName name of the metric to record
- * @deprecated since 2.2.0 in favor of
- * {@link #MetricsClientHttpRequestInterceptor(MeterRegistry, RestTemplateExchangeTagsProvider, String, AutoTimer)}
- */
- @Deprecated
- MetricsClientHttpRequestInterceptor(MeterRegistry meterRegistry, RestTemplateExchangeTagsProvider tagProvider,
- String metricName) {
- this(meterRegistry, tagProvider, metricName, AutoTimer.ENABLED);
- }
-
/**
* Create a new {@code MetricsClientHttpRequestInterceptor}.
* @param meterRegistry the registry to which metrics are recorded
diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/MetricsRestTemplateCustomizer.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/MetricsRestTemplateCustomizer.java
index 889d9b28d0..1cacb64164 100644
--- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/MetricsRestTemplateCustomizer.java
+++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/MetricsRestTemplateCustomizer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -39,22 +39,6 @@ public class MetricsRestTemplateCustomizer implements RestTemplateCustomizer {
private final MetricsClientHttpRequestInterceptor interceptor;
- /**
- * Creates a new {@code MetricsRestTemplateInterceptor} that will record metrics using
- * the given {@code meterRegistry} with tags provided by the given
- * {@code tagProvider}.
- * @param meterRegistry the meter registry
- * @param tagProvider the tag provider
- * @param metricName the name of the recorded metric
- * @deprecated since 2.2.0 in favor of
- * {@link #MetricsRestTemplateCustomizer(MeterRegistry, RestTemplateExchangeTagsProvider, String, AutoTimer)}
- */
- @Deprecated
- public MetricsRestTemplateCustomizer(MeterRegistry meterRegistry, RestTemplateExchangeTagsProvider tagProvider,
- String metricName) {
- this(meterRegistry, tagProvider, metricName, AutoTimer.ENABLED);
- }
-
/**
* Creates a new {@code MetricsRestTemplateInterceptor}. When {@code autoTimeRequests}
* is set to {@code true}, the interceptor records metrics using the given
diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/client/MetricsWebClientCustomizer.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/client/MetricsWebClientCustomizer.java
index 911c0c71bd..5b4be59ba1 100644
--- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/client/MetricsWebClientCustomizer.java
+++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/client/MetricsWebClientCustomizer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -33,22 +33,6 @@ public class MetricsWebClientCustomizer implements WebClientCustomizer {
private final MetricsWebClientFilterFunction filterFunction;
- /**
- * Create a new {@code MetricsWebClientFilterFunction} that will record metrics using
- * the given {@code meterRegistry} with tags provided by the given
- * {@code tagProvider}.
- * @param meterRegistry the meter registry
- * @param tagProvider the tag provider
- * @param metricName the name of the recorded metric
- * @deprecated since 2.2.0 in favor of
- * {@link #MetricsWebClientCustomizer(MeterRegistry, WebClientExchangeTagsProvider, String, AutoTimer)}
- */
- @Deprecated
- public MetricsWebClientCustomizer(MeterRegistry meterRegistry, WebClientExchangeTagsProvider tagProvider,
- String metricName) {
- this(meterRegistry, tagProvider, metricName, AutoTimer.ENABLED);
- }
-
/**
* Create a new {@code MetricsWebClientFilterFunction} that will record metrics using
* the given {@code meterRegistry} with tags provided by the given
diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/client/MetricsWebClientFilterFunction.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/client/MetricsWebClientFilterFunction.java
index 8cc9506cf4..5ecb25f641 100644
--- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/client/MetricsWebClientFilterFunction.java
+++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/client/MetricsWebClientFilterFunction.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -50,20 +50,6 @@ public class MetricsWebClientFilterFunction implements ExchangeFilterFunction {
private final AutoTimer autoTimer;
- /**
- * Create a new {@code MetricsWebClientFilterFunction}.
- * @param meterRegistry the registry to which metrics are recorded
- * @param tagProvider provider for metrics tags
- * @param metricName name of the metric to record
- * @deprecated since 2.2.0 in favor of
- * {@link #MetricsWebClientFilterFunction(MeterRegistry, WebClientExchangeTagsProvider, String, AutoTimer)}
- */
- @Deprecated
- public MetricsWebClientFilterFunction(MeterRegistry meterRegistry, WebClientExchangeTagsProvider tagProvider,
- String metricName) {
- this(meterRegistry, tagProvider, metricName, AutoTimer.ENABLED);
- }
-
/**
* Create a new {@code MetricsWebClientFilterFunction}.
* @param meterRegistry the registry to which metrics are recorded
diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/MetricsWebFilter.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/MetricsWebFilter.java
index faf21ebfb7..09760ba24a 100644
--- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/MetricsWebFilter.java
+++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/MetricsWebFilter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -49,21 +49,6 @@ public class MetricsWebFilter implements WebFilter {
private final AutoTimer autoTimer;
- /**
- * Create a new {@code MetricsWebFilter}.
- * @param registry the registry to which metrics are recorded
- * @param tagsProvider provider for metrics tags
- * @param metricName name of the metric to record
- * @param autoTimeRequests if requests should be automatically timed
- * @deprecated since 2.2.0 in favor of
- * {@link #MetricsWebFilter(MeterRegistry, WebFluxTagsProvider, String, AutoTimer)}
- */
- @Deprecated
- public MetricsWebFilter(MeterRegistry registry, WebFluxTagsProvider tagsProvider, String metricName,
- boolean autoTimeRequests) {
- this(registry, tagsProvider, metricName, AutoTimer.ENABLED);
- }
-
/**
* Create a new {@code MetricsWebFilter}.
* @param registry the registry to which metrics are recorded
diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsFilter.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsFilter.java
index 7cc029ffaf..035fe2d7d0 100644
--- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsFilter.java
+++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsFilter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -60,22 +60,6 @@ public class WebMvcMetricsFilter extends OncePerRequestFilter {
private final AutoTimer autoTimer;
- /**
- * Create a new {@link WebMvcMetricsFilter} instance.
- * @param registry the meter registry
- * @param tagsProvider the tags provider
- * @param metricName the metric name
- * @param autoTimeRequests if requests should be automatically timed
- * @since 2.0.7
- * @deprecated since 2.2.0 in favor of
- * {@link #WebMvcMetricsFilter(MeterRegistry, WebMvcTagsProvider, String, AutoTimer)}
- */
- @Deprecated
- public WebMvcMetricsFilter(MeterRegistry registry, WebMvcTagsProvider tagsProvider, String metricName,
- boolean autoTimeRequests) {
- this(registry, tagsProvider, metricName, AutoTimer.ENABLED);
- }
-
/**
* Create a new {@link WebMvcMetricsFilter} instance.
* @param registry the meter registry
diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchHealthIndicatorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchHealthIndicatorTests.java
deleted file mode 100644
index 7f49fa29bf..0000000000
--- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchHealthIndicatorTests.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * Copyright 2012-2019 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
- *
- * https://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.actuate.elasticsearch;
-
-import java.util.Map;
-
-import org.elasticsearch.ElasticsearchException;
-import org.elasticsearch.ElasticsearchTimeoutException;
-import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest;
-import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
-import org.elasticsearch.action.support.PlainActionFuture;
-import org.elasticsearch.client.AdminClient;
-import org.elasticsearch.client.Client;
-import org.elasticsearch.client.ClusterAdminClient;
-import org.elasticsearch.cluster.ClusterState;
-import org.elasticsearch.cluster.block.ClusterBlocks;
-import org.elasticsearch.cluster.health.ClusterHealthStatus;
-import org.elasticsearch.cluster.node.DiscoveryNodes;
-import org.elasticsearch.cluster.routing.RoutingTable;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-import org.springframework.boot.actuate.health.Health;
-import org.springframework.boot.actuate.health.Status;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.BDDMockito.given;
-
-/**
- * Test for {@link ElasticsearchHealthIndicator}.
- *
- * @author Andy Wilkinson
- */
-@Deprecated
-class ElasticsearchHealthIndicatorTests {
-
- @Mock
- private Client client;
-
- @Mock
- private AdminClient admin;
-
- @Mock
- private ClusterAdminClient cluster;
-
- private ElasticsearchHealthIndicator indicator;
-
- @BeforeEach
- void setUp() {
- MockitoAnnotations.initMocks(this);
- given(this.client.admin()).willReturn(this.admin);
- given(this.admin.cluster()).willReturn(this.cluster);
- this.indicator = new ElasticsearchHealthIndicator(this.client, 100L);
- }
-
- @Test
- void defaultConfigurationQueriesAllIndicesWith100msTimeout() {
- TestActionFuture responseFuture = new TestActionFuture();
- responseFuture.onResponse(new StubClusterHealthResponse());
- ArgumentCaptor requestCaptor = ArgumentCaptor.forClass(ClusterHealthRequest.class);
- given(this.cluster.health(requestCaptor.capture())).willReturn(responseFuture);
- Health health = this.indicator.health();
- assertThat(responseFuture.getTimeout).isEqualTo(100L);
- assertThat(requestCaptor.getValue().indices()).contains("_all");
- assertThat(health.getStatus()).isEqualTo(Status.UP);
- }
-
- @Test
- void certainIndices() {
- this.indicator = new ElasticsearchHealthIndicator(this.client, 100L, "test-index-1", "test-index-2");
- PlainActionFuture responseFuture = new PlainActionFuture<>();
- responseFuture.onResponse(new StubClusterHealthResponse());
- ArgumentCaptor requestCaptor = ArgumentCaptor.forClass(ClusterHealthRequest.class);
- given(this.cluster.health(requestCaptor.capture())).willReturn(responseFuture);
- Health health = this.indicator.health();
- assertThat(requestCaptor.getValue().indices()).contains("test-index-1", "test-index-2");
- assertThat(health.getStatus()).isEqualTo(Status.UP);
- }
-
- @Test
- void customTimeout() {
- this.indicator = new ElasticsearchHealthIndicator(this.client, 1000L);
- TestActionFuture responseFuture = new TestActionFuture();
- responseFuture.onResponse(new StubClusterHealthResponse());
- ArgumentCaptor requestCaptor = ArgumentCaptor.forClass(ClusterHealthRequest.class);
- given(this.cluster.health(requestCaptor.capture())).willReturn(responseFuture);
- this.indicator.health();
- assertThat(responseFuture.getTimeout).isEqualTo(1000L);
- }
-
- @Test
- void healthDetails() {
- PlainActionFuture responseFuture = new PlainActionFuture<>();
- responseFuture.onResponse(new StubClusterHealthResponse());
- given(this.cluster.health(any(ClusterHealthRequest.class))).willReturn(responseFuture);
- Health health = this.indicator.health();
- assertThat(health.getStatus()).isEqualTo(Status.UP);
- Map details = health.getDetails();
- assertDetail(details, "clusterName", "test-cluster");
- assertDetail(details, "activeShards", 1);
- assertDetail(details, "relocatingShards", 2);
- assertDetail(details, "activePrimaryShards", 3);
- assertDetail(details, "initializingShards", 4);
- assertDetail(details, "unassignedShards", 5);
- assertDetail(details, "numberOfNodes", 6);
- assertDetail(details, "numberOfDataNodes", 7);
- }
-
- @Test
- void redResponseMapsToDown() {
- PlainActionFuture responseFuture = new PlainActionFuture<>();
- responseFuture.onResponse(new StubClusterHealthResponse(ClusterHealthStatus.RED));
- given(this.cluster.health(any(ClusterHealthRequest.class))).willReturn(responseFuture);
- assertThat(this.indicator.health().getStatus()).isEqualTo(Status.DOWN);
- }
-
- @Test
- void yellowResponseMapsToUp() {
- PlainActionFuture responseFuture = new PlainActionFuture<>();
- responseFuture.onResponse(new StubClusterHealthResponse(ClusterHealthStatus.YELLOW));
- given(this.cluster.health(any(ClusterHealthRequest.class))).willReturn(responseFuture);
- assertThat(this.indicator.health().getStatus()).isEqualTo(Status.UP);
- }
-
- @Test
- void responseTimeout() {
- PlainActionFuture responseFuture = new PlainActionFuture<>();
- given(this.cluster.health(any(ClusterHealthRequest.class))).willReturn(responseFuture);
- Health health = this.indicator.health();
- assertThat(health.getStatus()).isEqualTo(Status.DOWN);
- assertThat((String) health.getDetails().get("error")).contains(ElasticsearchTimeoutException.class.getName());
- }
-
- @SuppressWarnings("unchecked")
- private void assertDetail(Map details, String detail, T value) {
- assertThat((T) details.get(detail)).isEqualTo(value);
- }
-
- private static final class StubClusterHealthResponse extends ClusterHealthResponse {
-
- private final ClusterHealthStatus status;
-
- private StubClusterHealthResponse() {
- this(ClusterHealthStatus.GREEN);
- }
-
- private StubClusterHealthResponse(ClusterHealthStatus status) {
- super("test-cluster", new String[0], new ClusterState(null, 0, null, null, RoutingTable.builder().build(),
- DiscoveryNodes.builder().build(), ClusterBlocks.builder().build(), null, 1, false));
- this.status = status;
- }
-
- @Override
- public int getActiveShards() {
- return 1;
- }
-
- @Override
- public int getRelocatingShards() {
- return 2;
- }
-
- @Override
- public int getActivePrimaryShards() {
- return 3;
- }
-
- @Override
- public int getInitializingShards() {
- return 4;
- }
-
- @Override
- public int getUnassignedShards() {
- return 5;
- }
-
- @Override
- public int getNumberOfNodes() {
- return 6;
- }
-
- @Override
- public int getNumberOfDataNodes() {
- return 7;
- }
-
- @Override
- public ClusterHealthStatus getStatus() {
- return this.status;
- }
-
- }
-
- static class TestActionFuture extends PlainActionFuture {
-
- private long getTimeout = -1L;
-
- @Override
- public ClusterHealthResponse actionGet(long timeoutMillis) throws ElasticsearchException {
- this.getTimeout = timeoutMillis;
- return super.actionGet(timeoutMillis);
- }
-
- }
-
-}
diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ApplicationHealthIndicatorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ApplicationHealthIndicatorTests.java
deleted file mode 100644
index eb257665e6..0000000000
--- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ApplicationHealthIndicatorTests.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2012-2019 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
- *
- * https://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.actuate.health;
-
-import org.junit.jupiter.api.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * Tests for {@link ApplicationHealthIndicator}.
- *
- * @author Phillip Webb
- */
-@Deprecated
-class ApplicationHealthIndicatorTests {
-
- @Test
- void indicatesUp() {
- ApplicationHealthIndicator healthIndicator = new ApplicationHealthIndicator();
- assertThat(healthIndicator.health().getStatus()).isEqualTo(Status.UP);
- }
-
-}
diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/CompositeHealthIndicatorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/CompositeHealthIndicatorTests.java
deleted file mode 100644
index 9d9ea8572e..0000000000
--- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/CompositeHealthIndicatorTests.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright 2012-2019 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
- *
- * https://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.actuate.health;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.BDDMockito.given;
-
-/**
- * Tests for {@link CompositeHealthIndicator}
- *
- * @author Tyler J. Frederick
- * @author Phillip Webb
- * @author Christian Dupuis
- */
-@Deprecated
-class CompositeHealthIndicatorTests {
-
- private HealthAggregator healthAggregator;
-
- @Mock
- private HealthIndicator one;
-
- @Mock
- private HealthIndicator two;
-
- @BeforeEach
- void setup() {
- MockitoAnnotations.initMocks(this);
- given(this.one.health()).willReturn(new Health.Builder().unknown().withDetail("1", "1").build());
- given(this.two.health()).willReturn(new Health.Builder().unknown().withDetail("2", "2").build());
-
- this.healthAggregator = new OrderedHealthAggregator();
- }
-
- @Test
- void createWithIndicators() {
- Map indicators = new HashMap<>();
- indicators.put("one", this.one);
- indicators.put("two", this.two);
- CompositeHealthIndicator composite = new CompositeHealthIndicator(this.healthAggregator, indicators);
- Health result = composite.health();
- assertThat(result.getDetails()).hasSize(2);
- assertThat(result.getDetails()).containsEntry("one",
- new Health.Builder().unknown().withDetail("1", "1").build());
- assertThat(result.getDetails()).containsEntry("two",
- new Health.Builder().unknown().withDetail("2", "2").build());
- }
-
- @Test
- void testSerialization() throws Exception {
- Map indicators = new LinkedHashMap<>();
- indicators.put("db1", this.one);
- indicators.put("db2", this.two);
- CompositeHealthIndicator innerComposite = new CompositeHealthIndicator(this.healthAggregator, indicators);
- CompositeHealthIndicator composite = new CompositeHealthIndicator(this.healthAggregator,
- Collections.singletonMap("db", innerComposite));
- Health result = composite.health();
- ObjectMapper mapper = new ObjectMapper();
- assertThat(mapper.writeValueAsString(result))
- .isEqualTo("{\"status\":\"UNKNOWN\",\"details\":{\"db\":{\"status\":\"UNKNOWN\""
- + ",\"details\":{\"db1\":{\"status\":\"UNKNOWN\",\"details\""
- + ":{\"1\":\"1\"}},\"db2\":{\"status\":\"UNKNOWN\",\"details\":{\"2\":\"2\"}}}}}}");
- }
-
-}
diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/CompositeReactiveHealthIndicatorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/CompositeReactiveHealthIndicatorTests.java
deleted file mode 100644
index f8818b560f..0000000000
--- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/CompositeReactiveHealthIndicatorTests.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright 2012-2019 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
- *
- * https://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.actuate.health;
-
-import java.time.Duration;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.junit.jupiter.api.Test;
-import reactor.core.publisher.Mono;
-import reactor.test.StepVerifier;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * Tests for {@link CompositeReactiveHealthIndicator}.
- *
- * @author Stephane Nicoll
- */
-@Deprecated
-class CompositeReactiveHealthIndicatorTests {
-
- private static final Health UNKNOWN_HEALTH = Health.unknown().withDetail("detail", "value").build();
-
- private static final Health HEALTHY = Health.up().build();
-
- private OrderedHealthAggregator healthAggregator = new OrderedHealthAggregator();
-
- @Test
- void singleIndicator() {
- CompositeReactiveHealthIndicator indicator = new CompositeReactiveHealthIndicator(this.healthAggregator,
- new DefaultReactiveHealthIndicatorRegistry(Collections.singletonMap("test", () -> Mono.just(HEALTHY))));
- StepVerifier.create(indicator.health()).consumeNextWith((h) -> {
- assertThat(h.getStatus()).isEqualTo(Status.UP);
- assertThat(h.getDetails()).containsOnlyKeys("test");
- assertThat(h.getDetails().get("test")).isEqualTo(HEALTHY);
- }).verifyComplete();
- }
-
- @Test
- void longHealth() {
- Map indicators = new HashMap<>();
- for (int i = 0; i < 50; i++) {
- indicators.put("test" + i, new TimeoutHealth(10000, Status.UP));
- }
- CompositeReactiveHealthIndicator indicator = new CompositeReactiveHealthIndicator(this.healthAggregator,
- new DefaultReactiveHealthIndicatorRegistry(indicators));
- StepVerifier.withVirtualTime(indicator::health).expectSubscription().thenAwait(Duration.ofMillis(10000))
- .consumeNextWith((h) -> {
- assertThat(h.getStatus()).isEqualTo(Status.UP);
- assertThat(h.getDetails()).hasSize(50);
- }).verifyComplete();
-
- }
-
- @Test
- void timeoutReachedUsesFallback() {
- Map indicators = new HashMap<>();
- indicators.put("slow", new TimeoutHealth(10000, Status.UP));
- indicators.put("fast", new TimeoutHealth(10, Status.UP));
- CompositeReactiveHealthIndicator indicator = new CompositeReactiveHealthIndicator(this.healthAggregator,
- new DefaultReactiveHealthIndicatorRegistry(indicators)).timeoutStrategy(100, UNKNOWN_HEALTH);
- StepVerifier.create(indicator.health()).consumeNextWith((h) -> {
- assertThat(h.getStatus()).isEqualTo(Status.UP);
- assertThat(h.getDetails()).containsOnlyKeys("slow", "fast");
- assertThat(h.getDetails().get("slow")).isEqualTo(UNKNOWN_HEALTH);
- assertThat(h.getDetails().get("fast")).isEqualTo(HEALTHY);
- }).verifyComplete();
- }
-
- @Test
- void timeoutNotReached() {
- Map indicators = new HashMap<>();
- indicators.put("slow", new TimeoutHealth(10000, Status.UP));
- indicators.put("fast", new TimeoutHealth(10, Status.UP));
- CompositeReactiveHealthIndicator indicator = new CompositeReactiveHealthIndicator(this.healthAggregator,
- new DefaultReactiveHealthIndicatorRegistry(indicators)).timeoutStrategy(20000, null);
- StepVerifier.withVirtualTime(indicator::health).expectSubscription().thenAwait(Duration.ofMillis(10000))
- .consumeNextWith((h) -> {
- assertThat(h.getStatus()).isEqualTo(Status.UP);
- assertThat(h.getDetails()).containsOnlyKeys("slow", "fast");
- assertThat(h.getDetails().get("slow")).isEqualTo(HEALTHY);
- assertThat(h.getDetails().get("fast")).isEqualTo(HEALTHY);
- }).verifyComplete();
- }
-
- static class TimeoutHealth implements ReactiveHealthIndicator {
-
- private final long timeout;
-
- private final Status status;
-
- TimeoutHealth(long timeout, Status status) {
- this.timeout = timeout;
- this.status = status;
- }
-
- @Override
- public Mono health() {
- return Mono.delay(Duration.ofMillis(this.timeout)).map((l) -> Health.status(this.status).build());
- }
-
- }
-
-}
diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/DefaultHealthIndicatorRegistryTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/DefaultHealthIndicatorRegistryTests.java
deleted file mode 100644
index 53a68f8912..0000000000
--- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/DefaultHealthIndicatorRegistryTests.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright 2012-2019 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
- *
- * https://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.actuate.health;
-
-import java.util.Map;
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
-import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
-import static org.mockito.BDDMockito.given;
-import static org.mockito.Mockito.mock;
-
-/**
- * Tests for {@link DefaultHealthIndicatorRegistry}.
- *
- * @author Vedran Pavic
- * @author Stephane Nicoll
- */
-@Deprecated
-class DefaultHealthIndicatorRegistryTests {
-
- private HealthIndicator one = mock(HealthIndicator.class);
-
- private HealthIndicator two = mock(HealthIndicator.class);
-
- private DefaultHealthIndicatorRegistry registry;
-
- @BeforeEach
- void setUp() {
- given(this.one.health()).willReturn(new Health.Builder().unknown().withDetail("1", "1").build());
- given(this.two.health()).willReturn(new Health.Builder().unknown().withDetail("2", "2").build());
- this.registry = new DefaultHealthIndicatorRegistry();
- }
-
- @Test
- void register() {
- this.registry.register("one", this.one);
- this.registry.register("two", this.two);
- assertThat(this.registry.getAll()).hasSize(2);
- assertThat(this.registry.get("one")).isSameAs(this.one);
- assertThat(this.registry.get("two")).isSameAs(this.two);
- }
-
- @Test
- void registerAlreadyUsedName() {
- this.registry.register("one", this.one);
- assertThatIllegalStateException().isThrownBy(() -> this.registry.register("one", this.two))
- .withMessageContaining("HealthIndicator with name 'one' already registered");
- }
-
- @Test
- void unregister() {
- this.registry.register("one", this.one);
- this.registry.register("two", this.two);
- assertThat(this.registry.getAll()).hasSize(2);
- HealthIndicator two = this.registry.unregister("two");
- assertThat(two).isSameAs(this.two);
- assertThat(this.registry.getAll()).hasSize(1);
- }
-
- @Test
- void unregisterUnknown() {
- this.registry.register("one", this.one);
- assertThat(this.registry.getAll()).hasSize(1);
- HealthIndicator two = this.registry.unregister("two");
- assertThat(two).isNull();
- assertThat(this.registry.getAll()).hasSize(1);
- }
-
- @Test
- void getAllIsASnapshot() {
- this.registry.register("one", this.one);
- Map snapshot = this.registry.getAll();
- assertThat(snapshot).containsOnlyKeys("one");
- this.registry.register("two", this.two);
- assertThat(snapshot).containsOnlyKeys("one");
- }
-
- @Test
- void getAllIsImmutable() {
- this.registry.register("one", this.one);
- Map snapshot = this.registry.getAll();
- assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(snapshot::clear);
- }
-
-}
diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/DefaultReactiveHealthIndicatorRegistryTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/DefaultReactiveHealthIndicatorRegistryTests.java
deleted file mode 100644
index 117d8ffc6f..0000000000
--- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/DefaultReactiveHealthIndicatorRegistryTests.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright 2012-2019 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
- *
- * https://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.actuate.health;
-
-import java.util.Map;
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import reactor.core.publisher.Mono;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
-import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
-import static org.mockito.BDDMockito.given;
-import static org.mockito.Mockito.mock;
-
-/**
- * Tests for {@link DefaultReactiveHealthIndicatorRegistry}.
- *
- * @author Vedran Pavic
- * @author Stephane Nicoll
- */
-@Deprecated
-class DefaultReactiveHealthIndicatorRegistryTests {
-
- private ReactiveHealthIndicator one = mock(ReactiveHealthIndicator.class);
-
- private ReactiveHealthIndicator two = mock(ReactiveHealthIndicator.class);
-
- private DefaultReactiveHealthIndicatorRegistry registry;
-
- @BeforeEach
- void setUp() {
- given(this.one.health()).willReturn(Mono.just(new Health.Builder().unknown().withDetail("1", "1").build()));
- given(this.two.health()).willReturn(Mono.just(new Health.Builder().unknown().withDetail("2", "2").build()));
- this.registry = new DefaultReactiveHealthIndicatorRegistry();
- }
-
- @Test
- void register() {
- this.registry.register("one", this.one);
- this.registry.register("two", this.two);
- assertThat(this.registry.getAll()).hasSize(2);
- assertThat(this.registry.get("one")).isSameAs(this.one);
- assertThat(this.registry.get("two")).isSameAs(this.two);
- }
-
- @Test
- void registerAlreadyUsedName() {
- this.registry.register("one", this.one);
- assertThatIllegalStateException().isThrownBy(() -> this.registry.register("one", this.two))
- .withMessageContaining("HealthIndicator with name 'one' already registered");
- }
-
- @Test
- void unregister() {
- this.registry.register("one", this.one);
- this.registry.register("two", this.two);
- assertThat(this.registry.getAll()).hasSize(2);
- ReactiveHealthIndicator two = this.registry.unregister("two");
- assertThat(two).isSameAs(this.two);
- assertThat(this.registry.getAll()).hasSize(1);
- }
-
- @Test
- void unregisterUnknown() {
- this.registry.register("one", this.one);
- assertThat(this.registry.getAll()).hasSize(1);
- ReactiveHealthIndicator two = this.registry.unregister("two");
- assertThat(two).isNull();
- assertThat(this.registry.getAll()).hasSize(1);
- }
-
- @Test
- void getAllIsASnapshot() {
- this.registry.register("one", this.one);
- Map snapshot = this.registry.getAll();
- assertThat(snapshot).containsOnlyKeys("one");
- this.registry.register("two", this.two);
- assertThat(snapshot).containsOnlyKeys("one");
- }
-
- @Test
- void getAllIsImmutable() {
- this.registry.register("one", this.one);
- Map snapshot = this.registry.getAll();
- assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(snapshot::clear);
- }
-
-}
diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthEndpointTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthEndpointTests.java
index 40f8578b62..c50722cd07 100644
--- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthEndpointTests.java
+++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthEndpointTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -24,7 +24,6 @@ import org.junit.jupiter.api.Test;
import org.springframework.boot.actuate.health.HealthEndpointSupport.HealthResult;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
import static org.mockito.Mockito.mock;
/**
@@ -35,15 +34,6 @@ import static org.mockito.Mockito.mock;
class HealthEndpointTests
extends HealthEndpointSupportTests {
- @Test
- @SuppressWarnings("deprecation")
- void createWhenUsingDeprecatedConstructorThrowsException() {
- HealthIndicator healthIndicator = mock(HealthIndicator.class);
- assertThatIllegalStateException().isThrownBy(() -> new HealthEndpoint(healthIndicator))
- .withMessage("Unable to create class org.springframework.boot.actuate.health.HealthEndpoint "
- + "using deprecated constructor");
- }
-
@Test
void healthReturnsSystemHealth() {
this.registry.registerContributor("test", createContributor(this.up));
diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthEndpointWebExtensionTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthEndpointWebExtensionTests.java
index b80241cbe6..692e7fd8d2 100644
--- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthEndpointWebExtensionTests.java
+++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthEndpointWebExtensionTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -27,7 +27,6 @@ import org.springframework.boot.actuate.endpoint.web.WebEndpointResponse;
import org.springframework.boot.actuate.health.HealthEndpointSupport.HealthResult;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
import static org.mockito.Mockito.mock;
/**
@@ -38,16 +37,6 @@ import static org.mockito.Mockito.mock;
class HealthEndpointWebExtensionTests
extends HealthEndpointSupportTests {
- @Test
- @SuppressWarnings("deprecation")
- void createWhenUsingDeprecatedConstructorThrowsException() {
- HealthEndpoint delegate = mock(HealthEndpoint.class);
- HealthWebEndpointResponseMapper responseMapper = mock(HealthWebEndpointResponseMapper.class);
- assertThatIllegalStateException().isThrownBy(() -> new HealthEndpointWebExtension(delegate, responseMapper))
- .withMessage("Unable to create class org.springframework.boot.actuate."
- + "health.HealthEndpointWebExtension using deprecated constructor");
- }
-
@Test
void healthReturnsSystemHealth() {
this.registry.registerContributor("test", createContributor(this.up));
diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthIndicatorReactiveAdapterTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthIndicatorReactiveAdapterTests.java
index 494a9d6b70..1506c751f9 100644
--- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthIndicatorReactiveAdapterTests.java
+++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthIndicatorReactiveAdapterTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -29,7 +29,6 @@ import static org.mockito.Mockito.mock;
*
* @author Stephane Nicoll
*/
-@SuppressWarnings("deprecation")
class HealthIndicatorReactiveAdapterTests {
@Test
diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthWebEndpointResponseMapperTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthWebEndpointResponseMapperTests.java
deleted file mode 100644
index aba93fa613..0000000000
--- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthWebEndpointResponseMapperTests.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright 2012-2019 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
- *
- * https://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.actuate.health;
-
-import java.security.Principal;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-import java.util.function.Supplier;
-
-import org.junit.jupiter.api.Test;
-import org.mockito.stubbing.Answer;
-
-import org.springframework.boot.actuate.endpoint.SecurityContext;
-import org.springframework.boot.actuate.endpoint.web.WebEndpointResponse;
-import org.springframework.http.HttpStatus;
-import org.springframework.security.core.Authentication;
-import org.springframework.security.core.authority.SimpleGrantedAuthority;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.BDDMockito.given;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyNoInteractions;
-
-/**
- * Tests for {@link HealthWebEndpointResponseMapper}.
- *
- * @author Stephane Nicoll
- */
-@Deprecated
-class HealthWebEndpointResponseMapperTests {
-
- private final HealthStatusHttpMapper statusHttpMapper = new HealthStatusHttpMapper();
-
- private Set authorizedRoles = Collections.singleton("ACTUATOR");
-
- @Test
- void mapDetailsWithDisableDetailsDoesNotInvokeSupplier() {
- HealthWebEndpointResponseMapper mapper = createMapper(ShowDetails.NEVER);
- Supplier supplier = mockSupplier();
- SecurityContext securityContext = mock(SecurityContext.class);
- WebEndpointResponse response = mapper.mapDetails(supplier, securityContext);
- assertThat(response.getStatus()).isEqualTo(HttpStatus.NOT_FOUND.value());
- verifyNoInteractions(supplier);
- verifyNoInteractions(securityContext);
- }
-
- @Test
- void mapDetailsWithUnauthorizedUserDoesNotInvokeSupplier() {
- HealthWebEndpointResponseMapper mapper = createMapper(ShowDetails.WHEN_AUTHORIZED);
- Supplier supplier = mockSupplier();
- SecurityContext securityContext = mockSecurityContext("USER");
- WebEndpointResponse response = mapper.mapDetails(supplier, securityContext);
- assertThat(response.getStatus()).isEqualTo(HttpStatus.NOT_FOUND.value());
- assertThat(response.getBody()).isNull();
- verifyNoInteractions(supplier);
- verify(securityContext).isUserInRole("ACTUATOR");
- }
-
- @Test
- void mapDetailsWithAuthorizedUserInvokesSupplier() {
- HealthWebEndpointResponseMapper mapper = createMapper(ShowDetails.WHEN_AUTHORIZED);
- Supplier supplier = mockSupplier();
- given(supplier.get()).willReturn(Health.down().build());
- SecurityContext securityContext = mockSecurityContext("ACTUATOR");
- WebEndpointResponse response = mapper.mapDetails(supplier, securityContext);
- assertThat(response.getStatus()).isEqualTo(HttpStatus.SERVICE_UNAVAILABLE.value());
- assertThat(response.getBody().getStatus()).isEqualTo(Status.DOWN);
- verify(supplier).get();
- verify(securityContext).isUserInRole("ACTUATOR");
- }
-
- @Test
- void mapDetailsWithRightAuthoritiesInvokesSupplier() {
- HealthWebEndpointResponseMapper mapper = createMapper(ShowDetails.WHEN_AUTHORIZED);
- Supplier supplier = mockSupplier();
- given(supplier.get()).willReturn(Health.down().build());
- SecurityContext securityContext = getSecurityContext("ACTUATOR");
- WebEndpointResponse response = mapper.mapDetails(supplier, securityContext);
- assertThat(response.getStatus()).isEqualTo(HttpStatus.SERVICE_UNAVAILABLE.value());
- assertThat(response.getBody().getStatus()).isEqualTo(Status.DOWN);
- verify(supplier).get();
- }
-
- @Test
- void mapDetailsWithOtherAuthoritiesShouldNotInvokeSupplier() {
- HealthWebEndpointResponseMapper mapper = createMapper(ShowDetails.WHEN_AUTHORIZED);
- Supplier supplier = mockSupplier();
- given(supplier.get()).willReturn(Health.down().build());
- SecurityContext securityContext = getSecurityContext("OTHER");
- WebEndpointResponse response = mapper.mapDetails(supplier, securityContext);
- assertThat(response.getStatus()).isEqualTo(HttpStatus.NOT_FOUND.value());
- assertThat(response.getBody()).isNull();
- verifyNoInteractions(supplier);
- }
-
- private SecurityContext getSecurityContext(String other) {
- SecurityContext securityContext = mock(SecurityContext.class);
- Authentication principal = mock(Authentication.class);
- given(securityContext.getPrincipal()).willReturn(principal);
- given(principal.getAuthorities())
- .willAnswer((invocation) -> Collections.singleton(new SimpleGrantedAuthority(other)));
- return securityContext;
- }
-
- @Test
- void mapDetailsWithUnavailableHealth() {
- HealthWebEndpointResponseMapper mapper = createMapper(ShowDetails.ALWAYS);
- Supplier supplier = mockSupplier();
- SecurityContext securityContext = mock(SecurityContext.class);
- WebEndpointResponse response = mapper.mapDetails(supplier, securityContext);
- assertThat(response.getStatus()).isEqualTo(HttpStatus.NOT_FOUND.value());
- assertThat(response.getBody()).isNull();
- verify(supplier).get();
- verifyNoInteractions(securityContext);
- }
-
- @SuppressWarnings("unchecked")
- private Supplier mockSupplier() {
- return mock(Supplier.class);
- }
-
- private SecurityContext mockSecurityContext(String... roles) {
- List associatedRoles = Arrays.asList(roles);
- SecurityContext securityContext = mock(SecurityContext.class);
- given(securityContext.getPrincipal()).willReturn(mock(Principal.class));
- given(securityContext.isUserInRole(anyString())).will((Answer) (invocation) -> {
- String expectedRole = invocation.getArgument(0);
- return associatedRoles.contains(expectedRole);
- });
- return securityContext;
- }
-
- private HealthWebEndpointResponseMapper createMapper(ShowDetails showDetails) {
- return new HealthWebEndpointResponseMapper(this.statusHttpMapper, showDetails, this.authorizedRoles);
- }
-
-}
diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/OrderedHealthAggregatorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/OrderedHealthAggregatorTests.java
deleted file mode 100644
index d98eb67514..0000000000
--- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/OrderedHealthAggregatorTests.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright 2012-2019 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
- *
- * https://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.actuate.health;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * Tests for {@link OrderedHealthAggregator}.
- *
- * @author Christian Dupuis
- */
-@Deprecated
-class OrderedHealthAggregatorTests {
-
- private OrderedHealthAggregator healthAggregator;
-
- @BeforeEach
- void setup() {
- this.healthAggregator = new OrderedHealthAggregator();
- }
-
- @Test
- void defaultOrder() {
- Map healths = new HashMap<>();
- healths.put("h1", new Health.Builder().status(Status.DOWN).build());
- healths.put("h2", new Health.Builder().status(Status.UP).build());
- healths.put("h3", new Health.Builder().status(Status.UNKNOWN).build());
- healths.put("h4", new Health.Builder().status(Status.OUT_OF_SERVICE).build());
- assertThat(this.healthAggregator.aggregate(healths).getStatus()).isEqualTo(Status.DOWN);
- }
-
- @Test
- void customOrder() {
- this.healthAggregator.setStatusOrder(Status.UNKNOWN, Status.UP, Status.OUT_OF_SERVICE, Status.DOWN);
- Map healths = new HashMap<>();
- healths.put("h1", new Health.Builder().status(Status.DOWN).build());
- healths.put("h2", new Health.Builder().status(Status.UP).build());
- healths.put("h3", new Health.Builder().status(Status.UNKNOWN).build());
- healths.put("h4", new Health.Builder().status(Status.OUT_OF_SERVICE).build());
- assertThat(this.healthAggregator.aggregate(healths).getStatus()).isEqualTo(Status.UNKNOWN);
- }
-
- @Test
- void defaultOrderWithCustomStatus() {
- Map healths = new HashMap<>();
- healths.put("h1", new Health.Builder().status(Status.DOWN).build());
- healths.put("h2", new Health.Builder().status(Status.UP).build());
- healths.put("h3", new Health.Builder().status(Status.UNKNOWN).build());
- healths.put("h4", new Health.Builder().status(Status.OUT_OF_SERVICE).build());
- healths.put("h5", new Health.Builder().status(new Status("CUSTOM")).build());
- assertThat(this.healthAggregator.aggregate(healths).getStatus()).isEqualTo(Status.DOWN);
- }
-
- @Test
- void customOrderWithCustomStatus() {
- this.healthAggregator.setStatusOrder(Arrays.asList("DOWN", "OUT_OF_SERVICE", "UP", "UNKNOWN", "CUSTOM"));
- Map healths = new HashMap<>();
- healths.put("h1", new Health.Builder().status(Status.DOWN).build());
- healths.put("h2", new Health.Builder().status(Status.UP).build());
- healths.put("h3", new Health.Builder().status(Status.UNKNOWN).build());
- healths.put("h4", new Health.Builder().status(Status.OUT_OF_SERVICE).build());
- healths.put("h5", new Health.Builder().status(new Status("CUSTOM")).build());
- assertThat(this.healthAggregator.aggregate(healths).getStatus()).isEqualTo(Status.DOWN);
- }
-
-}
diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ReactiveHealthContributorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ReactiveHealthContributorTests.java
index 8f89f860d7..201d79e0ac 100644
--- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ReactiveHealthContributorTests.java
+++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ReactiveHealthContributorTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -39,7 +39,6 @@ class ReactiveHealthContributorTests {
}
@Test
- @SuppressWarnings("deprecation")
void adaptWhenHealthIndicatorReturnsHealthIndicatorReactiveAdapter() {
HealthIndicator indicator = () -> Health.outOfService().build();
ReactiveHealthContributor adapted = ReactiveHealthContributor.adapt(indicator);
diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ReactiveHealthEndpointWebExtensionTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ReactiveHealthEndpointWebExtensionTests.java
index ce79a32e1f..7d097eb148 100644
--- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ReactiveHealthEndpointWebExtensionTests.java
+++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ReactiveHealthEndpointWebExtensionTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -28,7 +28,6 @@ import org.springframework.boot.actuate.endpoint.web.WebEndpointResponse;
import org.springframework.boot.actuate.health.HealthEndpointSupport.HealthResult;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
import static org.mockito.Mockito.mock;
/**
@@ -39,17 +38,6 @@ import static org.mockito.Mockito.mock;
class ReactiveHealthEndpointWebExtensionTests extends
HealthEndpointSupportTests> {
- @Test
- @SuppressWarnings("deprecation")
- void createWhenUsingDeprecatedConstructorThrowsException() {
- ReactiveHealthIndicator delegate = mock(ReactiveHealthIndicator.class);
- HealthWebEndpointResponseMapper responseMapper = mock(HealthWebEndpointResponseMapper.class);
- assertThatIllegalStateException()
- .isThrownBy(() -> new ReactiveHealthEndpointWebExtension(delegate, responseMapper)).withMessage(
- "Unable to create class org.springframework.boot.actuate.health.ReactiveHealthEndpointWebExtension "
- + "using deprecated constructor");
- }
-
@Test
void healthReturnsSystemHealth() {
this.registry.registerContributor("test", createContributor(this.up));
diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ReactiveHealthIndicatorRegistryFactoryTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ReactiveHealthIndicatorRegistryFactoryTests.java
deleted file mode 100644
index 5939865f9e..0000000000
--- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ReactiveHealthIndicatorRegistryFactoryTests.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2012-2019 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
- *
- * https://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.actuate.health;
-
-import java.util.Collections;
-
-import org.junit.jupiter.api.Test;
-import reactor.core.publisher.Mono;
-import reactor.test.StepVerifier;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * Tests for {@link ReactiveHealthIndicatorRegistryFactory}.
- *
- * @author Stephane Nicoll
- */
-@Deprecated
-class ReactiveHealthIndicatorRegistryFactoryTests {
-
- private static final Health UP = new Health.Builder().status(Status.UP).build();
-
- private static final Health DOWN = new Health.Builder().status(Status.DOWN).build();
-
- private final ReactiveHealthIndicatorRegistryFactory factory = new ReactiveHealthIndicatorRegistryFactory();
-
- @Test
- void defaultHealthIndicatorNameFactory() {
- ReactiveHealthIndicatorRegistry registry = this.factory.createReactiveHealthIndicatorRegistry(
- Collections.singletonMap("myHealthIndicator", () -> Mono.just(UP)), null);
- assertThat(registry.getAll()).containsOnlyKeys("my");
- }
-
- @Test
- void healthIndicatorIsAdapted() {
- ReactiveHealthIndicatorRegistry registry = this.factory.createReactiveHealthIndicatorRegistry(
- Collections.singletonMap("test", () -> Mono.just(UP)), Collections.singletonMap("regular", () -> DOWN));
- assertThat(registry.getAll()).containsOnlyKeys("test", "regular");
- StepVerifier.create(registry.get("regular").health()).consumeNextWith((h) -> {
- assertThat(h.getStatus()).isEqualTo(Status.DOWN);
- assertThat(h.getDetails()).isEmpty();
- }).verifyComplete();
- }
-
-}
diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LogFileWebEndpointTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LogFileWebEndpointTests.java
index 432256b55f..2e9139be15 100644
--- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LogFileWebEndpointTests.java
+++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LogFileWebEndpointTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -74,16 +74,6 @@ class LogFileWebEndpointTests {
assertThat(contentOf(resource.getFile())).isEqualTo("--TEST--");
}
- @Test
- @Deprecated
- void resourceResponseWithLogFileAndDeprecatedProperty() throws Exception {
- this.environment.setProperty("logging.file", this.logFile.getAbsolutePath());
- LogFileWebEndpoint endpoint = new LogFileWebEndpoint(LogFile.get(this.environment), null);
- Resource resource = endpoint.logFile();
- assertThat(resource).isNotNull();
- assertThat(contentOf(resource.getFile())).isEqualTo("--TEST--");
- }
-
@Test
void resourceResponseWithExternalLogFile() throws Exception {
LogFileWebEndpoint endpoint = new LogFileWebEndpoint(null, this.logFile);
diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LogFileWebEndpointWebIntegrationTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LogFileWebEndpointWebIntegrationTests.java
index 3a0d2deaf2..702a759039 100644
--- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LogFileWebEndpointWebIntegrationTests.java
+++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LogFileWebEndpointWebIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -74,7 +74,7 @@ class LogFileWebEndpointWebIntegrationTests {
File logFile = new File(tempFile, "test.log");
FileCopyUtils.copy("--TEST--".getBytes(), logFile);
MockEnvironment environment = new MockEnvironment();
- environment.setProperty("logging.file", logFile.getAbsolutePath());
+ environment.setProperty("logging.file.name", logFile.getAbsolutePath());
return new LogFileWebEndpoint(LogFile.get(environment), null);
}
diff --git a/spring-boot-project/spring-boot-autoconfigure/build.gradle b/spring-boot-project/spring-boot-autoconfigure/build.gradle
index 1b66008b30..15677b247f 100644
--- a/spring-boot-project/spring-boot-autoconfigure/build.gradle
+++ b/spring-boot-project/spring-boot-autoconfigure/build.gradle
@@ -21,7 +21,6 @@ dependencies {
optional 'com.fasterxml.jackson.core:jackson-databind'
optional 'com.fasterxml.jackson.dataformat:jackson-dataformat-cbor'
optional 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml'
- optional 'com.fasterxml.jackson.datatype:jackson-datatype-joda'
optional 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
optional 'com.fasterxml.jackson.module:jackson-module-parameter-names'
optional 'com.google.code.gson:gson'
diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java
index 96f9c97fb3..d63b65483d 100644
--- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java
+++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -25,7 +25,6 @@ import org.springframework.amqp.core.AcknowledgeMode;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory.CacheMode;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory.ConfirmType;
import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
import org.springframework.boot.convert.DurationUnit;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
@@ -289,17 +288,6 @@ public class RabbitProperties {
this.requestedChannelMax = requestedChannelMax;
}
- @DeprecatedConfigurationProperty(reason = "replaced to support additional confirm types",
- replacement = "spring.rabbitmq.publisher-confirm-type")
- public boolean isPublisherConfirms() {
- return ConfirmType.CORRELATED.equals(this.publisherConfirmType);
- }
-
- @Deprecated
- public void setPublisherConfirms(boolean publisherConfirms) {
- this.publisherConfirmType = (publisherConfirms) ? ConfirmType.CORRELATED : ConfirmType.NONE;
- }
-
public boolean isPublisherReturns() {
return this.publisherReturns;
}
@@ -732,28 +720,6 @@ public class RabbitProperties {
this.maxConcurrency = maxConcurrency;
}
- /**
- * Return the number of messages processed in one transaction.
- * @return the number of messages
- * @deprecated since 2.2.0 in favor of {@link SimpleContainer#getBatchSize()}
- */
- @DeprecatedConfigurationProperty(replacement = "spring.rabbitmq.listener.simple.batch-size")
- @Deprecated
- public Integer getTransactionSize() {
- return getBatchSize();
- }
-
- /**
- * Set the number of messages processed in one transaction.
- * @param transactionSize the number of messages
- * @deprecated since 2.2.0 in favor of
- * {@link SimpleContainer#setBatchSize(Integer)}
- */
- @Deprecated
- public void setTransactionSize(Integer transactionSize) {
- setBatchSize(transactionSize);
- }
-
public Integer getBatchSize() {
return this.batchSize;
}
diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunner.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunner.java
deleted file mode 100644
index 4b24806c72..0000000000
--- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunner.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2012-2019 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
- *
- * https://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.autoconfigure.batch;
-
-import org.springframework.batch.core.explore.JobExplorer;
-import org.springframework.batch.core.launch.JobLauncher;
-import org.springframework.batch.core.repository.JobRepository;
-import org.springframework.boot.ApplicationRunner;
-
-/**
- * {@link ApplicationRunner} to {@link JobLauncher launch} Spring Batch jobs. Runs all
- * jobs in the surrounding context by default. Can also be used to launch a specific job
- * by providing a jobName
- *
- * @author Dave Syer
- * @author Jean-Pierre Bergamin
- * @author Mahmoud Ben Hassine
- * @since 1.0.0
- * @deprecated since 2.2.0 in favor of {@link JobLauncherApplicationRunner}
- */
-@Deprecated
-public class JobLauncherCommandLineRunner extends JobLauncherApplicationRunner {
-
- /**
- * Create a new {@link JobLauncherCommandLineRunner}.
- * @param jobLauncher to launch jobs
- * @param jobExplorer to check the job repository for previous executions
- * @param jobRepository to check if a job instance exists with the given parameters
- * when running a job
- */
- public JobLauncherCommandLineRunner(JobLauncher jobLauncher, JobExplorer jobExplorer, JobRepository jobRepository) {
- super(jobLauncher, jobExplorer, jobRepository);
- }
-
-}
diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration.java
index ed6518cfb8..b3e537da94 100644
--- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration.java
+++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -34,14 +34,7 @@ import com.fasterxml.jackson.databind.Module;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.SerializationFeature;
-import com.fasterxml.jackson.databind.module.SimpleModule;
-import com.fasterxml.jackson.datatype.joda.cfg.JacksonJodaDateFormat;
-import com.fasterxml.jackson.datatype.joda.ser.DateTimeSerializer;
import com.fasterxml.jackson.module.paramnames.ParameterNamesModule;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.joda.time.DateTime;
-import org.joda.time.format.DateTimeFormat;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.BeanFactoryUtils;
@@ -110,49 +103,6 @@ public class JacksonAutoConfiguration {
}
- @Deprecated
- @Configuration(proxyBeanMethods = false)
- @ConditionalOnClass({ Jackson2ObjectMapperBuilder.class, DateTime.class, DateTimeSerializer.class,
- JacksonJodaDateFormat.class })
- static class JodaDateTimeJacksonConfiguration {
-
- private static final Log logger = LogFactory.getLog(JodaDateTimeJacksonConfiguration.class);
-
- @Bean
- SimpleModule jodaDateTimeSerializationModule(JacksonProperties jacksonProperties) {
- logger.warn("Auto-configuration of Jackson's Joda-Time integration is deprecated in favor of using "
- + "java.time (JSR-310).");
- SimpleModule module = new SimpleModule();
- JacksonJodaDateFormat jacksonJodaFormat = getJacksonJodaDateFormat(jacksonProperties);
- if (jacksonJodaFormat != null) {
- module.addSerializer(DateTime.class, new DateTimeSerializer(jacksonJodaFormat, 0));
- }
- return module;
- }
-
- private JacksonJodaDateFormat getJacksonJodaDateFormat(JacksonProperties jacksonProperties) {
- if (jacksonProperties.getJodaDateTimeFormat() != null) {
- return new JacksonJodaDateFormat(
- DateTimeFormat.forPattern(jacksonProperties.getJodaDateTimeFormat()).withZoneUTC());
- }
- if (jacksonProperties.getDateFormat() != null) {
- try {
- return new JacksonJodaDateFormat(
- DateTimeFormat.forPattern(jacksonProperties.getDateFormat()).withZoneUTC());
- }
- catch (IllegalArgumentException ex) {
- if (logger.isWarnEnabled()) {
- logger.warn("spring.jackson.date-format could not be used to "
- + "configure formatting of Joda's DateTime. You may want "
- + "to configure spring.jackson.joda-date-time-format as well.");
- }
- }
- }
- return null;
- }
-
- }
-
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(ParameterNamesModule.class)
static class ParameterNamesModuleConfiguration {
diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonProperties.java
index c19f9c3efb..7ec582a81e 100644
--- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonProperties.java
+++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonProperties.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -31,7 +31,6 @@ import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.SerializationFeature;
import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
/**
* Configuration properties to configure Jackson.
@@ -50,12 +49,6 @@ public class JacksonProperties {
*/
private String dateFormat;
- /**
- * Joda date time format string. If not configured, "date-format" is used as a
- * fallback if it is configured with a format string.
- */
- private String jodaDateTimeFormat;
-
/**
* One of the constants on Jackson's PropertyNamingStrategy. Can also be a
* fully-qualified class name of a PropertyNamingStrategy subclass.
@@ -118,18 +111,6 @@ public class JacksonProperties {
this.dateFormat = dateFormat;
}
- @Deprecated
- @DeprecatedConfigurationProperty(replacement = "dateFormat",
- reason = "Auto-configuration for Jackson's Joda-Time integration is "
- + "deprecated in favor of its Java 8 Time integration")
- public String getJodaDateTimeFormat() {
- return this.jodaDateTimeFormat;
- }
-
- public void setJodaDateTimeFormat(String jodaDataTimeFormat) {
- this.jodaDateTimeFormat = jodaDataTimeFormat;
- }
-
public String getPropertyNamingStrategy() {
return this.propertyNamingStrategy;
}
diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaProperties.java
index 909496791f..9a208af28e 100644
--- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaProperties.java
+++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaProperties.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -21,8 +21,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import javax.sql.DataSource;
-
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.orm.jpa.vendor.Database;
@@ -129,20 +127,4 @@ public class JpaProperties {
this.openInView = openInView;
}
- /**
- * Determine the {@link Database} to use based on this configuration and the primary
- * {@link DataSource}.
- * @param dataSource the auto-configured data source
- * @return {@code Database}
- * @deprecated since 2.2.0 in favor of letting the JPA container detect the database
- * to use.
- */
- @Deprecated
- public Database determineDatabase(DataSource dataSource) {
- if (this.database != null) {
- return this.database;
- }
- return DatabaseLookup.getDatabase(dataSource);
- }
-
}
diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/format/WebConversionService.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/format/WebConversionService.java
index fa1df0bfc2..b356b9fe1d 100644
--- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/format/WebConversionService.java
+++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/format/WebConversionService.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -21,11 +21,9 @@ import java.time.format.ResolverStyle;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.joda.time.format.DateTimeFormatterBuilder;
import org.springframework.format.datetime.DateFormatter;
import org.springframework.format.datetime.DateFormatterRegistrar;
-import org.springframework.format.datetime.joda.JodaTimeFormatterRegistrar;
import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar;
import org.springframework.format.number.NumberFormatAnnotationFormatterFactory;
import org.springframework.format.number.money.CurrencyUnitFormatter;
@@ -51,10 +49,6 @@ public class WebConversionService extends DefaultFormattingConversionService {
private static final boolean JSR_354_PRESENT = ClassUtils.isPresent("javax.money.MonetaryAmount",
WebConversionService.class.getClassLoader());
- @Deprecated
- private static final boolean JODA_TIME_PRESENT = ClassUtils.isPresent("org.joda.time.LocalDate",
- WebConversionService.class.getClassLoader());
-
private static final Log logger = LogFactory.getLog(WebConversionService.class);
private final String dateFormat;
@@ -83,9 +77,6 @@ public class WebConversionService extends DefaultFormattingConversionService {
addFormatterForFieldAnnotation(new Jsr354NumberFormatAnnotationFormatterFactory());
}
registerJsr310();
- if (JODA_TIME_PRESENT) {
- registerJodaTime();
- }
registerJavaDate();
}
@@ -98,16 +89,6 @@ public class WebConversionService extends DefaultFormattingConversionService {
dateTime.registerFormatters(this);
}
- @Deprecated
- private void registerJodaTime() {
- logger.warn("Auto-configuration of Joda-Time formatters is deprecated in favor of using java.time (JSR-310).");
- JodaTimeFormatterRegistrar jodaTime = new JodaTimeFormatterRegistrar();
- if (this.dateFormat != null) {
- jodaTime.setDateFormatter(new DateTimeFormatterBuilder().appendPattern(this.dateFormat).toFormatter());
- }
- jodaTime.registerFormatters(this);
- }
-
private void registerJavaDate() {
DateFormatterRegistrar dateFormatterRegistrar = new DateFormatterRegistrar();
if (this.dateFormat != null) {
diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java
index ab80ca7500..00b79cffe9 100644
--- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java
+++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -201,17 +201,6 @@ class RabbitAutoConfigurationTests {
});
}
- @Test
- @Deprecated
- void testConnectionFactoryPublisherConfirmTypeUsingDeprecatedProperty() {
- this.contextRunner.withUserConfiguration(TestConfiguration.class)
- .withPropertyValues("spring.rabbitmq.publisher-confirms=true").run((context) -> {
- CachingConnectionFactory connectionFactory = context.getBean(CachingConnectionFactory.class);
- assertThat(connectionFactory.isPublisherConfirms()).isTrue();
- assertThat(connectionFactory.isSimplePublisherConfirms()).isFalse();
- });
- }
-
@Test
void testConnectionFactoryPublisherConfirmTypeCorrelated() {
this.contextRunner.withUserConfiguration(TestConfiguration.class)
@@ -459,18 +448,6 @@ class RabbitAutoConfigurationTests {
});
}
- @Test
- @Deprecated
- void testRabbitListenerContainerFactoryWithDeprecatedTransactionSizeStillWorks() {
- this.contextRunner
- .withUserConfiguration(MessageConvertersConfiguration.class, MessageRecoverersConfiguration.class)
- .withPropertyValues("spring.rabbitmq.listener.simple.transactionSize:20").run((context) -> {
- SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory = context
- .getBean("rabbitListenerContainerFactory", SimpleRabbitListenerContainerFactory.class);
- assertThat(rabbitListenerContainerFactory).hasFieldOrPropertyWithValue("batchSize", 20);
- });
- }
-
@Test
void testDirectRabbitListenerContainerFactoryWithCustomSettings() {
this.contextRunner
diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitPropertiesTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitPropertiesTests.java
index ac84b9ff60..e249973247 100644
--- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitPropertiesTests.java
+++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitPropertiesTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -20,7 +20,6 @@ import org.junit.jupiter.api.Test;
import org.springframework.amqp.rabbit.config.DirectRabbitListenerContainerFactory;
import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory;
-import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
import org.springframework.amqp.rabbit.listener.DirectMessageListenerContainer;
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer;
@@ -293,24 +292,4 @@ class RabbitPropertiesTests {
assertThat(container).hasFieldOrPropertyWithValue("missingQueuesFatal", direct.isMissingQueuesFatal());
}
- @Test
- @Deprecated
- void isPublisherConfirmsShouldDefaultToFalse() {
- assertThat(this.properties.isPublisherConfirms()).isEqualTo(false);
- }
-
- @Test
- @Deprecated
- void isPublisherConfirmsWhenPublisherConfirmsTypeSimpleShouldBeFalse() {
- this.properties.setPublisherConfirmType(CachingConnectionFactory.ConfirmType.SIMPLE);
- assertThat(this.properties.isPublisherConfirms()).isEqualTo(false);
- }
-
- @Test
- @Deprecated
- void isPublisherConfirmsWhenPublisherConfirmsTypeCorrelatedShouldBeTrue() {
- this.properties.setPublisherConfirmType(CachingConnectionFactory.ConfirmType.CORRELATED);
- assertThat(this.properties.isPublisherConfirms()).isEqualTo(true);
- }
-
}
diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java
index cbdaae8b0e..baca05f41a 100644
--- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java
+++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -29,7 +29,6 @@ import com.fasterxml.jackson.annotation.JsonCreator.Mode;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.ObjectCodec;
import com.fasterxml.jackson.databind.AnnotationIntrospector;
import com.fasterxml.jackson.databind.DeserializationConfig;
@@ -43,11 +42,7 @@ import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.databind.util.StdDateFormat;
-import com.fasterxml.jackson.datatype.joda.cfg.FormatConfig;
import com.fasterxml.jackson.module.paramnames.ParameterNamesModule;
-import org.joda.time.DateTime;
-import org.joda.time.DateTimeZone;
-import org.joda.time.LocalDateTime;
import org.junit.jupiter.api.Test;
import org.springframework.boot.autoconfigure.AutoConfigurations;
@@ -80,15 +75,6 @@ class JacksonAutoConfigurationTests {
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(JacksonAutoConfiguration.class));
- @Test
- @Deprecated
- void registersJodaModuleAutomatically() {
- this.contextRunner.run((context) -> {
- ObjectMapper objectMapper = context.getBean(ObjectMapper.class);
- assertThat(objectMapper.canSerialize(LocalDateTime.class)).isTrue();
- });
- }
-
@Test
void doubleModuleRegistration() {
this.contextRunner.withUserConfiguration(DoubleModulesConfig.class)
@@ -117,19 +103,6 @@ class JacksonAutoConfigurationTests {
});
}
- @Test
- @Deprecated
- void customJodaDateTimeFormat() throws Exception {
- this.contextRunner.withPropertyValues("spring.jackson.date-format:yyyyMMddHHmmss",
- "spring.jackson.joda-date-time-format:yyyy-MM-dd HH:mm:ss").run((context) -> {
- ObjectMapper mapper = context.getBean(ObjectMapper.class);
- DateTime dateTime = new DateTime(1988, 6, 25, 20, 30, DateTimeZone.UTC);
- assertThat(mapper.writeValueAsString(dateTime)).isEqualTo("\"1988-06-25 20:30:00\"");
- Date date = dateTime.toDate();
- assertThat(mapper.writeValueAsString(date)).isEqualTo("\"19880625203000\"");
- });
- }
-
@Test
void customDateFormatClass() {
this.contextRunner.withPropertyValues(
@@ -294,8 +267,7 @@ class JacksonAutoConfigurationTests {
void moduleBeansAndWellKnownModulesAreRegisteredWithTheObjectMapperBuilder() {
this.contextRunner.withUserConfiguration(ModuleConfig.class).run((context) -> {
ObjectMapper objectMapper = context.getBean(Jackson2ObjectMapperBuilder.class).build();
- assertThat(context.getBean(CustomModule.class).getOwners()).contains((ObjectCodec) objectMapper);
- assertThat(objectMapper.canSerialize(LocalDateTime.class)).isTrue();
+ assertThat(context.getBean(CustomModule.class).getOwners()).contains(objectMapper);
assertThat(objectMapper.canSerialize(Baz.class)).isTrue();
});
}
@@ -319,17 +291,7 @@ class JacksonAutoConfigurationTests {
}
@Test
- void customTimeZoneFormattingADateTime() {
- this.contextRunner.withPropertyValues("spring.jackson.time-zone:America/Los_Angeles",
- "spring.jackson.date-format:zzzz", "spring.jackson.locale:en").run((context) -> {
- ObjectMapper objectMapper = context.getBean(Jackson2ObjectMapperBuilder.class).build();
- DateTime dateTime = new DateTime(1436966242231L, DateTimeZone.UTC);
- assertThat(objectMapper.writeValueAsString(dateTime)).isEqualTo("\"Pacific Daylight Time\"");
- });
- }
-
- @Test
- void customTimeZoneFormattingADate() throws JsonProcessingException {
+ void customTimeZoneFormattingADate() {
this.contextRunner.withPropertyValues("spring.jackson.time-zone:GMT+10", "spring.jackson.date-format:z")
.run((context) -> {
ObjectMapper objectMapper = context.getBean(Jackson2ObjectMapperBuilder.class).build();
@@ -338,17 +300,6 @@ class JacksonAutoConfigurationTests {
});
}
- @Test
- @Deprecated
- void customLocaleWithJodaTime() throws JsonProcessingException {
- this.contextRunner.withPropertyValues("spring.jackson.locale:de_DE", "spring.jackson.date-format:zzzz",
- "spring.jackson.serialization.write-dates-with-zone-id:true").run((context) -> {
- ObjectMapper objectMapper = context.getBean(ObjectMapper.class);
- DateTime jodaTime = new DateTime(1478424650000L, DateTimeZone.forID("Europe/Rome"));
- assertThat(objectMapper.writeValueAsString(jodaTime)).startsWith("\"Mitteleuropäische ");
- });
- }
-
@Test
void additionalJacksonBuilderCustomization() {
this.contextRunner.withUserConfiguration(ObjectMapperBuilderCustomConfig.class).run((context) -> {
@@ -368,17 +319,6 @@ class JacksonAutoConfigurationTests {
JacksonAutoConfiguration.class);
}
- @Test
- void writeDatesAsTimestampsDefault() {
- this.contextRunner.run((context) -> {
- ObjectMapper mapper = context.getBean(ObjectMapper.class);
- DateTime dateTime = new DateTime(1988, 6, 25, 20, 30, DateTimeZone.UTC);
- String expected = FormatConfig.DEFAULT_DATETIME_PRINTER.rawFormatter().withZone(DateTimeZone.UTC)
- .print(dateTime);
- assertThat(mapper.writeValueAsString(dateTime)).isEqualTo("\"" + expected + "\"");
- });
- }
-
@Test
void writeDurationAsTimestampsDefault() {
this.contextRunner.run((context) -> {
diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/JpaPropertiesTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/JpaPropertiesTests.java
deleted file mode 100644
index 2453e9d985..0000000000
--- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/JpaPropertiesTests.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright 2012-2019 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
- *
- * https://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.autoconfigure.orm.jpa;
-
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.SQLException;
-import java.util.function.Consumer;
-
-import javax.sql.DataSource;
-
-import org.junit.jupiter.api.Test;
-
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
-import org.springframework.boot.test.context.runner.ApplicationContextRunner;
-import org.springframework.boot.test.context.runner.ContextConsumer;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.orm.jpa.vendor.Database;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.BDDMockito.given;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.verify;
-
-/**
- * Tests for {@link JpaProperties}.
- *
- * @author Stephane Nicoll
- */
-class JpaPropertiesTests {
-
- private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
- .withUserConfiguration(TestConfiguration.class);
-
- @Test
- @Deprecated
- @SuppressWarnings("deprecation")
- void determineDatabaseNoCheckIfDatabaseIsSet() {
- this.contextRunner.withPropertyValues("spring.jpa.database=postgresql")
- .run(assertJpaProperties((properties) -> {
- DataSource dataSource = mockStandaloneDataSource();
- Database database = properties.determineDatabase(dataSource);
- assertThat(database).isEqualTo(Database.POSTGRESQL);
- try {
- verify(dataSource, never()).getConnection();
- }
- catch (SQLException ex) {
- throw new IllegalStateException("Should not happen", ex);
- }
- }));
- }
-
- @Test
- @Deprecated
- @SuppressWarnings("deprecation")
- void determineDatabaseWithKnownUrl() {
- this.contextRunner.run(assertJpaProperties((properties) -> {
- Database database = properties.determineDatabase(mockDataSource("jdbc:h2:mem:testdb"));
- assertThat(database).isEqualTo(Database.H2);
- }));
- }
-
- @Test
- @Deprecated
- @SuppressWarnings("deprecation")
- void determineDatabaseWithKnownUrlAndUserConfig() {
- this.contextRunner.withPropertyValues("spring.jpa.database=mysql").run(assertJpaProperties((properties) -> {
- Database database = properties.determineDatabase(mockDataSource("jdbc:h2:mem:testdb"));
- assertThat(database).isEqualTo(Database.MYSQL);
- }));
- }
-
- @Test
- @Deprecated
- @SuppressWarnings("deprecation")
- void determineDatabaseWithUnknownUrl() {
- this.contextRunner.run(assertJpaProperties((properties) -> {
- Database database = properties.determineDatabase(mockDataSource("jdbc:unknown://localhost"));
- assertThat(database).isEqualTo(Database.DEFAULT);
- }));
- }
-
- private DataSource mockStandaloneDataSource() {
- try {
- DataSource ds = mock(DataSource.class);
- given(ds.getConnection()).willThrow(SQLException.class);
- return ds;
- }
- catch (SQLException ex) {
- throw new IllegalStateException("Should not happen", ex);
- }
- }
-
- private DataSource mockDataSource(String jdbcUrl) {
- DataSource ds = mock(DataSource.class);
- try {
- DatabaseMetaData metadata = mock(DatabaseMetaData.class);
- given(metadata.getURL()).willReturn(jdbcUrl);
- Connection connection = mock(Connection.class);
- given(connection.getMetaData()).willReturn(metadata);
- given(ds.getConnection()).willReturn(connection);
- }
- catch (SQLException ex) {
- // Do nothing
- }
- return ds;
- }
-
- private ContextConsumer assertJpaProperties(Consumer consumer) {
- return (context) -> {
- assertThat(context).hasSingleBean(JpaProperties.class);
- consumer.accept(context.getBean(JpaProperties.class));
- };
- }
-
- @Configuration(proxyBeanMethods = false)
- @EnableConfigurationProperties(JpaProperties.class)
- static class TestConfiguration {
-
- }
-
-}
diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/format/WebConversionServiceTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/format/WebConversionServiceTests.java
index 7b4724122d..dde2a4e7b1 100644
--- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/format/WebConversionServiceTests.java
+++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/format/WebConversionServiceTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -20,8 +20,6 @@ import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Date;
-import org.joda.time.DateTime;
-import org.joda.time.LocalDate;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
@@ -39,12 +37,6 @@ class WebConversionServiceTests {
customDateFormat(Date.from(ZonedDateTime.of(2018, 1, 1, 20, 30, 0, 0, ZoneId.systemDefault()).toInstant()));
}
- @Test
- @Deprecated
- void customDateFormatWithJodaTime() {
- customDateFormat(LocalDate.fromDateFields(new DateTime(2018, 1, 1, 20, 30).toDate()));
- }
-
@Test
void customDateFormatWithJavaTime() {
customDateFormat(java.time.LocalDate.of(2018, 1, 1));
diff --git a/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/GrabCommandIntegrationTests.java b/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/GrabCommandIntegrationTests.java
index f7a9f20db9..6c8874e0d5 100644
--- a/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/GrabCommandIntegrationTests.java
+++ b/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/GrabCommandIntegrationTests.java
@@ -61,7 +61,7 @@ class GrabCommandIntegrationTests {
System.setProperty("groovy.grape.report.downloads", "true");
// Use --autoconfigure=false to limit the amount of downloaded dependencies
String output = this.cli.grab("grab.groovy", "--autoconfigure=false");
- assertThat(new File(this.cli.getTemp(), "repository/joda-time/joda-time")).isDirectory();
+ assertThat(new File(this.cli.getTemp(), "repository/com/fasterxml/jackson/core/jackson-core")).isDirectory();
assertThat(output).contains("Downloading: ");
}
diff --git a/spring-boot-project/spring-boot-cli/src/test/resources/grab-samples/grab.groovy b/spring-boot-project/spring-boot-cli/src/test/resources/grab-samples/grab.groovy
index e99f623452..578226ed5a 100644
--- a/spring-boot-project/spring-boot-cli/src/test/resources/grab-samples/grab.groovy
+++ b/spring-boot-project/spring-boot-cli/src/test/resources/grab-samples/grab.groovy
@@ -1,4 +1,4 @@
-@Grab('joda-time')
+@Grab('jackson-core')
class GrabTest {
}
diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle
index f9ed786ddd..c73dc6c60f 100644
--- a/spring-boot-project/spring-boot-dependencies/build.gradle
+++ b/spring-boot-project/spring-boot-dependencies/build.gradle
@@ -911,13 +911,6 @@ bom {
]
}
}
- library('Joda Time', '2.10.5') {
- group('joda-time') {
- modules = [
- 'joda-time'
- ]
- }
- }
library('Johnzon', '1.2.2') {
group('org.apache.johnzon') {
modules = [
diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/reactive/WebTestClientBuilderCustomizer.java b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/reactive/WebTestClientBuilderCustomizer.java
deleted file mode 100644
index 750161e4d1..0000000000
--- a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/reactive/WebTestClientBuilderCustomizer.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2012-2019 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
- *
- * https://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.test.autoconfigure.web.reactive;
-
-import org.springframework.test.web.reactive.server.WebTestClient.Builder;
-
-/**
- * A customizer for a {@link Builder}. Any {@code WebTestClientBuilderCustomizer} beans
- * found in the application context will be {@link #customize called} to customize the
- * auto-configured {@link Builder}.
- *
- * @author Andy Wilkinson
- * @since 2.0.0
- * @see WebTestClientAutoConfiguration
- * @deprecated since 2.2 in favor of
- * {@link org.springframework.boot.test.web.reactive.server.WebTestClientBuilderCustomizer}
- */
-@FunctionalInterface
-@Deprecated
-public interface WebTestClientBuilderCustomizer
- extends org.springframework.boot.test.web.reactive.server.WebTestClientBuilderCustomizer {
-
-}
diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/rule/OutputCapture.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/rule/OutputCapture.java
deleted file mode 100644
index 1d4b1f31ed..0000000000
--- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/rule/OutputCapture.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2012-2019 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
- *
- * https://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.test.rule;
-
-import org.hamcrest.Matcher;
-import org.junit.rules.TestRule;
-import org.junit.runner.Description;
-import org.junit.runners.model.Statement;
-
-import org.springframework.boot.test.system.OutputCaptureRule;
-
-/**
- * JUnit {@code @Rule} to capture output from System.out and System.err.
- *
- * @author Phillip Webb
- * @author Andy Wilkinson
- * @since 1.4.0
- * @deprecated since 2.2.0 in favor of {@link OutputCaptureRule}
- */
-@Deprecated
-public class OutputCapture implements TestRule {
-
- private final OutputCaptureRule delegate = new OutputCaptureRule();
-
- @Override
- public Statement apply(Statement base, Description description) {
- return this.delegate.apply(base, description);
- }
-
- /**
- * Discard all currently accumulated output.
- */
- public void reset() {
- this.delegate.reset();
- }
-
- public void flush() {
- // Flushing is no longer necessary
- }
-
- @Override
- public String toString() {
- return this.delegate.toString();
- }
-
- /**
- * Verify that the output is matched by the supplied {@code matcher}. Verification is
- * performed after the test method has executed.
- * @param matcher the matcher
- */
- public void expect(Matcher super String> matcher) {
- this.delegate.expect(matcher);
- }
-
-}
diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/system/OutputCaptureRule.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/system/OutputCaptureRule.java
index 4eccfebd27..4297fe33c8 100644
--- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/system/OutputCaptureRule.java
+++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/system/OutputCaptureRule.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -81,15 +81,6 @@ public class OutputCaptureRule implements TestRule, CapturedOutput {
};
}
- /**
- * Resets the current capture session, clearing its captured output.
- * @deprecated since 2.2.0 with no replacement
- */
- @Deprecated
- public void reset() {
- OutputCaptureRule.this.delegate.reset();
- }
-
@Override
public String getAll() {
return this.delegate.getAll();
diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/rule/OutputCaptureTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/rule/OutputCaptureTests.java
deleted file mode 100644
index 68d9774e5f..0000000000
--- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/rule/OutputCaptureTests.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2012-2019 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
- *
- * https://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.test.rule;
-
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * Tests for {@link OutputCapture}.
- *
- * @author Roland Weisleder
- */
-@Deprecated
-public class OutputCaptureTests {
-
- @Rule
- public OutputCapture outputCapture = new OutputCapture();
-
- @Test
- public void toStringShouldReturnAllCapturedOutput() {
- System.out.println("Hello World");
- assertThat(this.outputCapture.toString()).contains("Hello World");
- }
-
- @Test
- public void reset() {
- System.out.println("Hello");
- this.outputCapture.reset();
- System.out.println("World");
- assertThat(this.outputCapture.toString()).doesNotContain("Hello").contains("World");
- }
-
-}
diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java
index 7ff22e469f..9091fc4a3b 100644
--- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java
+++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -94,15 +94,6 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
@Parameter(property = "spring-boot.run.addResources", defaultValue = "false")
private boolean addResources = false;
- /**
- * Path to agent jar. NOTE: a forked process is required to use this feature.
- * @since 1.0.0
- * @deprecated since 2.2.0 in favor of {@code agents}
- */
- @Deprecated
- @Parameter(property = "spring-boot.run.agent")
- private File[] agent;
-
/**
* Path to agent jars. NOTE: a forked process is required to use this feature.
* @since 2.2.0
@@ -240,20 +231,8 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
return this.fork;
}
- /**
- * Specify if fork should be enabled by default.
- * @return {@code true} if fork should be enabled by default
- * @see #logDisabledFork()
- * @deprecated as of 2.2.0 in favour of enabling forking by default.
- */
- @Deprecated
- protected boolean enableForkByDefault() {
- return hasAgent() || hasJvmArgs() || hasEnvVariables() || hasWorkingDirectorySet();
- }
-
private boolean hasAgent() {
- File[] configuredAgents = determineAgents();
- return (configuredAgents != null && configuredAgents.length > 0);
+ return (this.agents != null && this.agents.length > 0);
}
private boolean hasJvmArgs() {
@@ -398,12 +377,11 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
}
private void addAgents(List args) {
- File[] configuredAgents = determineAgents();
- if (configuredAgents != null) {
+ if (this.agents != null) {
if (getLog().isInfoEnabled()) {
- getLog().info("Attaching agents: " + Arrays.asList(configuredAgents));
+ getLog().info("Attaching agents: " + Arrays.asList(this.agents));
}
- for (File agent : configuredAgents) {
+ for (File agent : this.agents) {
args.add("-javaagent:" + agent);
}
}
@@ -412,10 +390,6 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
}
}
- private File[] determineAgents() {
- return (this.agents != null) ? this.agents : this.agent;
- }
-
private void addActiveProfileArgument(RunArguments arguments) {
if (this.profiles.length > 0) {
StringBuilder arg = new StringBuilder("--spring.profiles.active=");
diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunMojo.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunMojo.java
index 7b97246729..959dbc4872 100644
--- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunMojo.java
+++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunMojo.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -62,12 +62,6 @@ public class RunMojo extends AbstractRunMojo {
@Parameter(property = "spring-boot.run.optimizedLaunch", defaultValue = "true")
private boolean optimizedLaunch;
- @Override
- @Deprecated
- protected boolean enableForkByDefault() {
- return super.enableForkByDefault() || hasDevtools();
- }
-
@Override
protected void logDisabledFork() {
super.logDisabledFork();
diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiColors.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiColors.java
index dc6384c1e0..24a8afcbec 100644
--- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiColors.java
+++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiColors.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -130,17 +130,6 @@ public final class AnsiColors {
return closest;
}
- /**
- * Get the closest {@link AnsiColor ANSI color} to the given AWT {@link Color}.
- * @param color the color to find
- * @return the closest color
- * @deprecated since 2.2.0 in favor of {@link #findClosest(Color)}
- */
- @Deprecated
- public static AnsiColor getClosest(Color color) {
- return (AnsiColor) new AnsiColors(BitDepth.FOUR).findClosest(color);
- }
-
/**
* Represents a color stored in LAB form.
*/
diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/logging/LoggingApplicationListener.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/logging/LoggingApplicationListener.java
index de5e762c4b..e6974e7d18 100644
--- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/logging/LoggingApplicationListener.java
+++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/logging/LoggingApplicationListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -136,13 +136,6 @@ public class LoggingApplicationListener implements GenericApplicationListener {
*/
public static final String LOGGER_GROUPS_BEAN_NAME = "springBootLoggerGroups";
- /**
- * The name of the {@link LogFile} bean.
- * @deprecated since 2.2.0 in favor of {@link #LOG_FILE_BEAN_NAME}
- */
- @Deprecated
- public static final String LOGFILE_BEAN_NAME = LOG_FILE_BEAN_NAME;
-
private static final Map> DEFAULT_GROUP_LOGGERS;
static {
MultiValueMap loggers = new LinkedMultiValueMap<>();
@@ -333,7 +326,7 @@ public class LoggingApplicationListener implements GenericApplicationListener {
private void initializeFinalLoggingLevels(ConfigurableEnvironment environment, LoggingSystem system) {
bindLoggerGroups(environment);
if (this.springBootLogging != null) {
- initializeLogLevel(system, this.springBootLogging);
+ initializeSpringBootLogging(system, this.springBootLogging);
}
setLogLevels(system, environment);
}
@@ -345,19 +338,6 @@ public class LoggingApplicationListener implements GenericApplicationListener {
}
}
- /**
- * Initialize loggers based on the {@link #setSpringBootLogging(LogLevel)
- * springBootLogging} setting.
- * @param system the logging system
- * @param springBootLogging the spring boot logging level requested
- * @deprecated since 2.2.0 in favor of
- * {@link #initializeSpringBootLogging(LoggingSystem, LogLevel)}
- */
- @Deprecated
- protected void initializeLogLevel(LoggingSystem system, LogLevel springBootLogging) {
- initializeSpringBootLogging(system, springBootLogging);
- }
-
/**
* Initialize loggers based on the {@link #setSpringBootLogging(LogLevel)
* springBootLogging} setting. By default this implementation will pick an appropriate
@@ -372,20 +352,6 @@ public class LoggingApplicationListener implements GenericApplicationListener {
.forEach((name) -> configureLogLevel(name, springBootLogging, configurer));
}
- /**
- * Set logging levels based on relevant {@link Environment} properties.
- * @param system the logging system
- * @param environment the environment
- * @deprecated since 2.2.0 in favor of
- * {@link #setLogLevels(LoggingSystem, ConfigurableEnvironment)}
- */
- @Deprecated
- protected void setLogLevels(LoggingSystem system, Environment environment) {
- if (environment instanceof ConfigurableEnvironment) {
- setLogLevels(system, (ConfigurableEnvironment) environment);
- }
- }
-
/**
* Set logging levels based on relevant {@link Environment} properties.
* @param system the logging system
diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata.java
deleted file mode 100644
index 15df03eb30..0000000000
--- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright 2012-2019 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
- *
- * https://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.context.properties;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
-import org.springframework.beans.factory.support.BeanDefinitionRegistry;
-import org.springframework.beans.factory.support.GenericBeanDefinition;
-import org.springframework.beans.factory.support.RootBeanDefinition;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.core.annotation.AnnotationUtils;
-
-/**
- * Utility class to memorize {@code @Bean} definition metadata during initialization of
- * the bean factory.
- *
- * @author Dave Syer
- * @since 1.1.0
- * @deprecated since 2.2.0 in favor of {@link ConfigurationPropertiesBean}
- */
-@Deprecated
-public class ConfigurationBeanFactoryMetadata implements ApplicationContextAware {
-
- /**
- * The bean name that this class is registered with.
- */
- public static final String BEAN_NAME = ConfigurationBeanFactoryMetadata.class.getName();
-
- private ConfigurableApplicationContext applicationContext;
-
- public Map getBeansWithFactoryAnnotation(Class type) {
- Map result = new HashMap<>();
- for (String name : this.applicationContext.getBeanFactory().getBeanDefinitionNames()) {
- if (findFactoryAnnotation(name, type) != null) {
- result.put(name, this.applicationContext.getBean(name));
- }
- }
- return result;
- }
-
- public A findFactoryAnnotation(String beanName, Class type) {
- Method method = findFactoryMethod(beanName);
- return (method != null) ? AnnotationUtils.findAnnotation(method, type) : null;
- }
-
- public Method findFactoryMethod(String beanName) {
- ConfigurableListableBeanFactory beanFactory = this.applicationContext.getBeanFactory();
- if (beanFactory.containsBeanDefinition(beanName)) {
- BeanDefinition beanDefinition = beanFactory.getMergedBeanDefinition(beanName);
- if (beanDefinition instanceof RootBeanDefinition) {
- return ((RootBeanDefinition) beanDefinition).getResolvedFactoryMethod();
- }
- }
- return null;
- }
-
- @Override
- public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
- this.applicationContext = (ConfigurableApplicationContext) applicationContext;
- }
-
- static void register(BeanDefinitionRegistry registry) {
- if (!registry.containsBeanDefinition(BEAN_NAME)) {
- GenericBeanDefinition definition = new GenericBeanDefinition();
- definition.setBeanClass(ConfigurationBeanFactoryMetadata.class);
- definition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
- registry.registerBeanDefinition(ConfigurationBeanFactoryMetadata.BEAN_NAME, definition);
- }
- }
-
-}
diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java
index 102c677560..742078b655 100644
--- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java
+++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -49,30 +49,12 @@ public class ConfigurationPropertiesBindingPostProcessor
*/
public static final String BEAN_NAME = ConfigurationPropertiesBindingPostProcessor.class.getName();
- /**
- * The bean name of the configuration properties validator.
- * @deprecated since 2.2.0 in favor of
- * {@link EnableConfigurationProperties#VALIDATOR_BEAN_NAME}
- */
- @Deprecated
- public static final String VALIDATOR_BEAN_NAME = EnableConfigurationProperties.VALIDATOR_BEAN_NAME;
-
private ApplicationContext applicationContext;
private BeanDefinitionRegistry registry;
private ConfigurationPropertiesBinder binder;
- /**
- * Create a new {@link ConfigurationPropertiesBindingPostProcessor} instance.
- * @deprecated since 2.2.0 in favor of
- * {@link EnableConfigurationProperties @EnableConfigurationProperties} or
- * {@link ConfigurationPropertiesBindingPostProcessor#register(BeanDefinitionRegistry)}
- */
- @Deprecated
- public ConfigurationPropertiesBindingPostProcessor() {
- }
-
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorRegistrar.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorRegistrar.java
deleted file mode 100644
index 5d4a596333..0000000000
--- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorRegistrar.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2012-2019 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
- *
- * https://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.context.properties;
-
-import org.springframework.beans.factory.support.BeanDefinitionRegistry;
-import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
-import org.springframework.core.type.AnnotationMetadata;
-
-/**
- * {@link ImportBeanDefinitionRegistrar} for binding externalized application properties
- * to {@link ConfigurationProperties @ConfigurationProperties} beans.
- *
- * @author Dave Syer
- * @author Phillip Webb
- * @since 1.0.0
- * @deprecated since 2.2.0 in favor of
- * {@link EnableConfigurationProperties @EnableConfigurationProperties}
- */
-@Deprecated
-public class ConfigurationPropertiesBindingPostProcessorRegistrar implements ImportBeanDefinitionRegistrar {
-
- @Override
- public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
- // Spring Cloud Function may call this with a null importingClassMetadata
- if (importingClassMetadata == null) {
- EnableConfigurationPropertiesRegistrar.registerInfrastructureBeans(registry);
- return;
- }
- new EnableConfigurationPropertiesRegistrar().registerBeanDefinitions(importingClassMetadata, registry);
- }
-
-}
diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesRegistrar.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesRegistrar.java
index d5edb7f650..7dadda9bd9 100644
--- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesRegistrar.java
+++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesRegistrar.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -51,7 +51,6 @@ class EnableConfigurationPropertiesRegistrar implements ImportBeanDefinitionRegi
ConfigurationPropertiesBindingPostProcessor.register(registry);
BoundConfigurationProperties.register(registry);
ConfigurationPropertiesBeanDefinitionValidator.register(registry);
- ConfigurationBeanFactoryMetadata.register(registry);
}
}
diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindResult.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindResult.java
index fb8d1d8480..2cc1286659 100644
--- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindResult.java
+++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindResult.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -21,7 +21,6 @@ import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
-import org.springframework.beans.BeanUtils;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
@@ -113,19 +112,6 @@ public final class BindResult {
return (this.value != null) ? this.value : other.get();
}
- /**
- * Return the object that was bound, or a new instance of the specified class if no
- * value has been bound.
- * @param type the type to create if no value was bound
- * @return the value, if bound, otherwise a new instance of {@code type}
- * @deprecated since 2.2.0 in favor of {@link Binder#bindOrCreate}
- */
- @Deprecated
- public T orElseCreate(Class extends T> type) {
- Assert.notNull(type, "Type must not be null");
- return (this.value != null) ? this.value : BeanUtils.instantiateClass(type);
- }
-
/**
* Return the object that was bound, or throw an exception to be created by the
* provided supplier if no value has been bound.
diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LogFile.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LogFile.java
index 3ef1078bb9..b973bc9001 100644
--- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LogFile.java
+++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LogFile.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -37,22 +37,6 @@ import org.springframework.util.StringUtils;
*/
public class LogFile {
- /**
- * The name of the Spring property that contains the name of the log file. Names can
- * be an exact location or relative to the current directory.
- * @deprecated since 2.2.0 in favor of {@link #FILE_NAME_PROPERTY}
- */
- @Deprecated
- public static final String FILE_PROPERTY = "logging.file";
-
- /**
- * The name of the Spring property that contains the directory where log files are
- * written.
- * @deprecated since 2.2.0 in favor of {@link #FILE_PATH_PROPERTY}
- */
- @Deprecated
- public static final String PATH_PROPERTY = "logging.path";
-
/**
* The name of the Spring property that contains the name of the log file. Names can
* be an exact location or relative to the current directory.
@@ -128,21 +112,12 @@ public class LogFile {
* suitable properties
*/
public static LogFile get(PropertyResolver propertyResolver) {
- String file = getLogFileProperty(propertyResolver, FILE_NAME_PROPERTY, FILE_PROPERTY);
- String path = getLogFileProperty(propertyResolver, FILE_PATH_PROPERTY, PATH_PROPERTY);
+ String file = propertyResolver.getProperty(FILE_NAME_PROPERTY);
+ String path = propertyResolver.getProperty(FILE_PATH_PROPERTY);
if (StringUtils.hasLength(file) || StringUtils.hasLength(path)) {
return new LogFile(file, path);
}
return null;
}
- private static String getLogFileProperty(PropertyResolver propertyResolver, String propertyName,
- String deprecatedPropertyName) {
- String property = propertyResolver.getProperty(propertyName);
- if (property != null) {
- return property;
- }
- return propertyResolver.getProperty(deprecatedPropertyName);
- }
-
}
diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/context/AnnotationConfigReactiveWebApplicationContext.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/context/AnnotationConfigReactiveWebApplicationContext.java
index 569d9204fa..03797d4948 100644
--- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/context/AnnotationConfigReactiveWebApplicationContext.java
+++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/context/AnnotationConfigReactiveWebApplicationContext.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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,17 +16,11 @@
package org.springframework.boot.web.reactive.context;
-import org.springframework.beans.factory.support.BeanNameGenerator;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
-import org.springframework.context.annotation.AnnotatedBeanDefinitionReader;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-import org.springframework.context.annotation.ClassPathBeanDefinitionScanner;
import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.ImportResource;
-import org.springframework.context.annotation.ScopeMetadataResolver;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.io.Resource;
-import org.springframework.lang.Nullable;
import org.springframework.stereotype.Component;
/**
@@ -99,230 +93,4 @@ public class AnnotationConfigReactiveWebApplicationContext extends AnnotationCon
return new FilteredReactiveWebContextResource(path);
}
- /**
- * Return the custom {@link BeanNameGenerator} for use with
- * {@link AnnotatedBeanDefinitionReader} and/or
- * {@link ClassPathBeanDefinitionScanner}, if any.
- * @return the bean name generator
- * @deprecated since 2.2.0 since this class no longer extends
- * {@code AbstractRefreshableConfigApplicationContext}
- */
- @Deprecated
- protected final BeanNameGenerator getBeanNameGenerator() {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Return the custom {@link ScopeMetadataResolver} for use with
- * {@link AnnotatedBeanDefinitionReader} and/or
- * {@link ClassPathBeanDefinitionScanner}, if any.
- * @return the scope metadata resolver
- * @deprecated since 2.2.0 since this class no longer extends
- * {@code AbstractRefreshableConfigApplicationContext}
- */
- @Deprecated
- protected ScopeMetadataResolver getScopeMetadataResolver() {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Register a {@link org.springframework.beans.factory.config.BeanDefinition} for any
- * classes specified by {@link #register(Class...)} and scan any packages specified by
- * {@link #scan(String...)}.
- *
- * For any values specified by {@link #setConfigLocation(String)} or
- * {@link #setConfigLocations(String[])}, attempt first to load each location as a
- * class, registering a {@code BeanDefinition} if class loading is successful, and if
- * class loading fails (i.e. a {@code ClassNotFoundException} is raised), assume the
- * value is a package and attempt to scan it for annotated classes.
- *
- * Enables the default set of annotation configuration post processors, such that
- * {@code @Autowired}, {@code @Required}, and associated annotations can be used.
- *
- * Configuration class bean definitions are registered with generated bean definition
- * names unless the {@code value} attribute is provided to the stereotype annotation.
- * @param beanFactory the bean factory to load bean definitions into
- * @see #register(Class...)
- * @see #scan(String...)
- * @see #setConfigLocation(String)
- * @see #setConfigLocations(String[])
- * @see AnnotatedBeanDefinitionReader
- * @see ClassPathBeanDefinitionScanner
- * @deprecated since 2.2.0 since this class no longer extends
- * {@code AbstractRefreshableConfigApplicationContext}
- */
- @Deprecated
- protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Build an {@link AnnotatedBeanDefinitionReader} for the given bean factory.
- *
- * This should be pre-configured with the {@code Environment} (if desired) but not
- * with a {@code BeanNameGenerator} or {@code ScopeMetadataResolver} yet.
- * @param beanFactory the bean factory to load bean definitions into
- * @return the annotated bean definition reader
- * @see #getEnvironment()
- * @see #getBeanNameGenerator()
- * @see #getScopeMetadataResolver()
- * @deprecated since 2.2.0 since this class no longer extends
- * {@code AbstractRefreshableConfigApplicationContext}
- */
- @Deprecated
- protected AnnotatedBeanDefinitionReader getAnnotatedBeanDefinitionReader(DefaultListableBeanFactory beanFactory) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Build a {@link ClassPathBeanDefinitionScanner} for the given bean factory.
- *
- * This should be pre-configured with the {@code Environment} (if desired) but not
- * with a {@code BeanNameGenerator} or {@code ScopeMetadataResolver} yet.
- * @param beanFactory the bean factory to load bean definitions into
- * @return the class path bean definition scanner
- * @see #getEnvironment()
- * @see #getBeanNameGenerator()
- * @see #getScopeMetadataResolver()
- * @deprecated since 2.2.0 since this class no longer extends
- * {@code AbstractRefreshableConfigApplicationContext}
- */
- @Deprecated
- protected ClassPathBeanDefinitionScanner getClassPathBeanDefinitionScanner(DefaultListableBeanFactory beanFactory) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Set the config locations for this application context in init-param style, i.e.
- * with distinct locations separated by commas, semicolons or whitespace.
- *
- * If not set, the implementation may use a default as appropriate.
- * @param location the config location
- * @deprecated since 2.2.0 since this class no longer extends
- * {@code AbstractRefreshableConfigApplicationContext}. Use
- * {@link ImportResource @ImportResource} instead.
- */
- @Deprecated
- public void setConfigLocation(String location) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Set the config locations for this application context.
- *
- * If not set, the implementation may use a default as appropriate.
- * @param locations the config locations
- * @deprecated since 2.2.0 since this class no longer extends
- * {@code AbstractRefreshableConfigApplicationContext}. Use
- * {@link ImportResource @ImportResource} instead.
- */
- @Deprecated
- public void setConfigLocations(@Nullable String... locations) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Return an array of resource locations, referring to the XML bean definition files
- * that this context should be built with. Can also include location patterns, which
- * will get resolved via a ResourcePatternResolver.
- *
- * The default implementation returns {@code null}. Subclasses can override this to
- * provide a set of resource locations to load bean definitions from.
- * @return an array of resource locations, or {@code null} if none
- * @see #getResources
- * @see #getResourcePatternResolver
- * @deprecated since 2.2.0 since this class no longer extends
- * {@code AbstractRefreshableConfigApplicationContext}.
- */
- @Deprecated
- protected String[] getConfigLocations() {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Return the default config locations to use, for the case where no explicit config
- * locations have been specified.
- *
- * The default implementation returns {@code null}, requiring explicit config
- * locations.
- * @return an array of default config locations, if any
- * @see #setConfigLocations
- * @deprecated since 2.2.0 since this class no longer extends
- * {@code AbstractRefreshableConfigApplicationContext}.
- */
- @Deprecated
- protected String[] getDefaultConfigLocations() {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Resolve the given path, replacing placeholders with corresponding environment
- * property values if necessary. Applied to config locations.
- * @param path the original file path
- * @return the resolved file path
- * @see org.springframework.core.env.Environment#resolveRequiredPlaceholders(String)
- * @deprecated since 2.2.0 since this class no longer extends
- * {@code AbstractRefreshableConfigApplicationContext}.
- */
- @Deprecated
- protected String resolvePath(String path) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Determine whether this context currently holds a bean factory, i.e. has been
- * refreshed at least once and not been closed yet.
- * @return {@code true} if the context holds a bean factory
- * @deprecated since 2.2.0 since this class no longer extends
- * {@code AbstractRefreshableConfigApplicationContext}.
- */
- @Deprecated
- protected final boolean hasBeanFactory() {
- return true;
- }
-
- /**
- * Create an internal bean factory for this context. Called for each
- * {@link #refresh()} attempt.
- *
- * The default implementation creates a
- * {@link org.springframework.beans.factory.support.DefaultListableBeanFactory} with
- * the {@linkplain #getInternalParentBeanFactory() internal bean factory} of this
- * context's parent as parent bean factory. Can be overridden in subclasses, for
- * example to customize DefaultListableBeanFactory's settings.
- * @return the bean factory for this context
- * @see org.springframework.beans.factory.support.DefaultListableBeanFactory#setAllowBeanDefinitionOverriding
- * @see org.springframework.beans.factory.support.DefaultListableBeanFactory#setAllowEagerClassLoading
- * @see org.springframework.beans.factory.support.DefaultListableBeanFactory#setAllowCircularReferences
- * @see org.springframework.beans.factory.support.DefaultListableBeanFactory#setAllowRawInjectionDespiteWrapping
- * @deprecated since 2.2.0 since this class no longer extends
- * {@code AbstractRefreshableConfigApplicationContext}.
- */
- @Deprecated
- protected DefaultListableBeanFactory createBeanFactory() {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Customize the internal bean factory used by this context. Called for each
- * {@link #refresh()} attempt.
- *
- * The default implementation applies this context's
- * {@linkplain #setAllowBeanDefinitionOverriding "allowBeanDefinitionOverriding"} and
- * {@linkplain #setAllowCircularReferences "allowCircularReferences"} settings, if
- * specified. Can be overridden in subclasses to customize any of
- * {@link DefaultListableBeanFactory}'s settings.
- * @param beanFactory the newly created bean factory for this context
- * @see DefaultListableBeanFactory#setAllowBeanDefinitionOverriding
- * @see DefaultListableBeanFactory#setAllowCircularReferences
- * @see DefaultListableBeanFactory#setAllowRawInjectionDespiteWrapping
- * @see DefaultListableBeanFactory#setAllowEagerClassLoading
- * @deprecated since 2.2.0 since this class no longer extends
- * {@code AbstractRefreshableConfigApplicationContext}.
- */
- @Deprecated
- protected void customizeBeanFactory(DefaultListableBeanFactory beanFactory) {
- throw new UnsupportedOperationException();
- }
-
}
diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/context/ReactiveWebServerApplicationContext.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/context/ReactiveWebServerApplicationContext.java
index 9e6611e10a..172a8d9ab1 100644
--- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/context/ReactiveWebServerApplicationContext.java
+++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/context/ReactiveWebServerApplicationContext.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -111,19 +111,6 @@ public class ReactiveWebServerApplicationContext extends GenericReactiveWebAppli
return getBeanFactory().getBean(factoryBeanName, ReactiveWebServerFactory.class);
}
- /**
- * Return the {@link ReactiveWebServerFactory} that should be used to create the
- * reactive web server. By default this method searches for a suitable bean in the
- * context itself.
- * @return a {@link ReactiveWebServerFactory} (never {@code null})
- * @deprecated since 2.2.0 in favor of {@link #getWebServerFactoryBeanName()} and
- * {@link #getWebServerFactory(String)}
- */
- @Deprecated
- protected ReactiveWebServerFactory getWebServerFactory() {
- return getWebServerFactory(getWebServerFactoryBeanName());
- }
-
@Override
protected void finishRefresh() {
super.finishRefresh();
diff --git a/spring-boot-project/spring-boot/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-project/spring-boot/src/main/resources/META-INF/additional-spring-configuration-metadata.json
index 02d488929e..06d811582a 100644
--- a/spring-boot-project/spring-boot/src/main/resources/META-INF/additional-spring-configuration-metadata.json
+++ b/spring-boot-project/spring-boot/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -79,15 +79,6 @@
"defaultValue": "%wEx",
"sourceType": "org.springframework.boot.context.logging.LoggingApplicationListener"
},
- {
- "name": "logging.file",
- "type": "java.lang.String",
- "description": "Log file name (for instance, `myapp.log`). Names can be an exact location or relative to the current directory.",
- "sourceType": "org.springframework.boot.context.logging.LoggingApplicationListener",
- "deprecation": {
- "replacement": "logging.file.name"
- }
- },
{
"name": "logging.file.clean-history-on-start",
"type": "java.lang.Boolean",
@@ -140,15 +131,6 @@
"description": "Log levels severity mapping. For instance, `logging.level.org.springframework=DEBUG`.",
"sourceType": "org.springframework.boot.context.logging.LoggingApplicationListener"
},
- {
- "name": "logging.path",
- "type": "java.lang.String",
- "description": "Location of the log file. For instance, `/var/log`.",
- "sourceType": "org.springframework.boot.context.logging.LoggingApplicationListener",
- "deprecation": {
- "replacement": "logging.file.path"
- }
- },
{
"name": "logging.pattern.console",
"type": "java.lang.String",
@@ -833,6 +815,24 @@
"level": "error"
}
},
+ {
+ "name": "logging.file",
+ "type": "java.lang.String",
+ "description": "Log file name (for instance, `myapp.log`). Names can be an exact location or relative to the current directory.",
+ "deprecation": {
+ "replacement": "logging.file.name",
+ "level": "error"
+ }
+ },
+ {
+ "name": "logging.path",
+ "type": "java.lang.String",
+ "description": "Location of the log file. For instance, `/var/log`.",
+ "deprecation": {
+ "replacement": "logging.file.path",
+ "level": "error"
+ }
+ },
{
"name": "spring.application.index",
"type": "java.lang.Integer",
diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/logging/LoggingApplicationListenerIntegrationTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/logging/LoggingApplicationListenerIntegrationTests.java
index e88386364e..4f7e5eb341 100644
--- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/logging/LoggingApplicationListenerIntegrationTests.java
+++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/logging/LoggingApplicationListenerIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -59,7 +59,7 @@ class LoggingApplicationListenerIntegrationTests {
void logFileRegisteredInTheContextWhenApplicable(@TempDir File tempDir) throws Exception {
String logFile = new File(tempDir, "test.log").getAbsolutePath();
try (ConfigurableApplicationContext context = new SpringApplicationBuilder(SampleService.class)
- .web(WebApplicationType.NONE).properties("logging.file=" + logFile).run()) {
+ .web(WebApplicationType.NONE).properties("logging.file.name=" + logFile).run()) {
SampleService service = context.getBean(SampleService.class);
assertThat(service.logFile).isNotNull();
assertThat(service.logFile.toString()).isEqualTo(logFile);
diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/logging/LoggingApplicationListenerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/logging/LoggingApplicationListenerTests.java
index 9701681107..ff25b3f77d 100644
--- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/logging/LoggingApplicationListenerTests.java
+++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/logging/LoggingApplicationListenerTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -212,19 +212,6 @@ class LoggingApplicationListenerTests {
assertThat(output).startsWith(this.logFile.getAbsolutePath());
}
- @Test
- @Deprecated
- void addLogFilePropertyWithDeprecatedProperty() {
- addPropertiesToEnvironment(this.context, "logging.config=classpath:logback-nondefault.xml",
- "logging.file=" + this.logFile);
- this.initializer.initialize(this.context.getEnvironment(), this.context.getClassLoader());
- Log logger = LogFactory.getLog(LoggingApplicationListenerTests.class);
- String existingOutput = this.output.toString();
- logger.info("Hello world");
- String output = this.output.toString().substring(existingOutput.length()).trim();
- assertThat(output).startsWith(this.logFile.getAbsolutePath());
- }
-
@Test
void addLogFilePropertyWithDefault() {
assertThat(this.logFile).doesNotExist();
@@ -235,16 +222,6 @@ class LoggingApplicationListenerTests {
assertThat(this.logFile).isFile();
}
- @Test
- @Deprecated
- void addLogFilePropertyWithDefaultAndDeprecatedProperty() {
- addPropertiesToEnvironment(this.context, "logging.file=" + this.logFile);
- this.initializer.initialize(this.context.getEnvironment(), this.context.getClassLoader());
- Log logger = LogFactory.getLog(LoggingApplicationListenerTests.class);
- logger.info("Hello world");
- assertThat(this.logFile).isFile();
- }
-
@Test
void addLogPathProperty() {
addPropertiesToEnvironment(this.context, "logging.config=classpath:logback-nondefault.xml",
@@ -257,18 +234,6 @@ class LoggingApplicationListenerTests {
assertThat(output).startsWith(new File(this.tempDir.toFile(), "spring.log").getAbsolutePath());
}
- @Test
- void addLogPathPropertyWithDeprecatedProperty() {
- addPropertiesToEnvironment(this.context, "logging.config=classpath:logback-nondefault.xml",
- "logging.path=" + this.tempDir);
- this.initializer.initialize(this.context.getEnvironment(), this.context.getClassLoader());
- Log logger = LogFactory.getLog(LoggingApplicationListenerTests.class);
- String existingOutput = this.output.toString();
- logger.info("Hello world");
- String output = this.output.toString().substring(existingOutput.length()).trim();
- assertThat(output).startsWith(new File(this.tempDir.toFile(), "spring.log").getAbsolutePath());
- }
-
@Test
void parseDebugArg() {
addPropertiesToEnvironment(this.context, "debug");
@@ -495,15 +460,6 @@ class LoggingApplicationListenerTests {
assertThat(System.getProperty(LoggingSystemProperties.PID_KEY)).isNotNull();
}
- @Test
- @Deprecated
- void systemPropertiesAreSetForLoggingConfigurationWithDeprecatedProperties() {
- addPropertiesToEnvironment(this.context, "logging.file=" + this.logFile, "logging.path=path");
- this.initializer.initialize(this.context.getEnvironment(), this.context.getClassLoader());
- assertThat(System.getProperty(LoggingSystemProperties.LOG_FILE)).isEqualTo(this.logFile.getAbsolutePath());
- assertThat(System.getProperty(LoggingSystemProperties.LOG_PATH)).isEqualTo("path");
- }
-
@Test
void environmentPropertiesIgnoreUnresolvablePlaceholders() {
// gh-7719
diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesTests.java
index 266b06ab41..54da50ac43 100644
--- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesTests.java
+++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -99,7 +99,6 @@ import static org.mockito.Mockito.verify;
/**
* Tests for {@link ConfigurationProperties @ConfigurationProperties}-annotated beans.
* Covers {@link EnableConfigurationProperties @EnableConfigurationProperties},
- * {@link ConfigurationPropertiesBindingPostProcessorRegistrar},
* {@link ConfigurationPropertiesBindingPostProcessor} and
* {@link ConfigurationPropertiesBinder}.
*
diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BindResultTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BindResultTests.java
index 4a128f6a87..21c8b6298b 100644
--- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BindResultTests.java
+++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BindResultTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -150,29 +150,6 @@ class BindResultTests {
assertThat(result.orElseGet(this.supplier)).isEqualTo("bar");
}
- @Test
- @Deprecated
- @SuppressWarnings("deprecation")
- void orElseCreateWhenTypeIsNullShouldThrowException() {
- BindResult result = BindResult.of("foo");
- assertThatIllegalArgumentException().isThrownBy(() -> result.orElseCreate(null))
- .withMessageContaining("Type must not be null");
- }
-
- @Test
- @Deprecated
- void orElseCreateWhenHasValueShouldReturnValue() {
- BindResult result = BindResult.of(new ExampleBean("foo"));
- assertThat(result.orElseCreate(ExampleBean.class).getValue()).isEqualTo("foo");
- }
-
- @Test
- @Deprecated
- void orElseCreateWhenHasValueNoShouldReturnCreatedValue() {
- BindResult result = BindResult.of(null);
- assertThat(result.orElseCreate(ExampleBean.class).getValue()).isEqualTo("new");
- }
-
@Test
void orElseThrowWhenHasValueShouldReturnValue() throws Exception {
BindResult result = BindResult.of("foo");
diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/LogFileTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/LogFileTests.java
index 0ec5b5d4fc..f2f952217c 100644
--- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/LogFileTests.java
+++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/LogFileTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2020 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.
@@ -52,13 +52,6 @@ class LogFileTests {
testLoggingFile(resolver);
}
- @Test
- @Deprecated
- void loggingFileWithDeprecatedProperties() {
- PropertyResolver resolver = getPropertyResolver(Collections.singletonMap("logging.file", "log.file"));
- testLoggingFile(resolver);
- }
-
private void testLoggingFile(PropertyResolver resolver) {
LogFile logFile = LogFile.get(resolver);
Properties properties = new Properties();
@@ -74,13 +67,6 @@ class LogFileTests {
testLoggingPath(resolver);
}
- @Test
- @Deprecated
- void loggingPathWithDeprecatedProperties() {
- PropertyResolver resolver = getPropertyResolver(Collections.singletonMap("logging.path", "logpath"));
- testLoggingPath(resolver);
- }
-
private void testLoggingPath(PropertyResolver resolver) {
LogFile logFile = LogFile.get(resolver);
Properties properties = new Properties();
@@ -100,16 +86,6 @@ class LogFileTests {
testLoggingFileAndPath(resolver);
}
- @Test
- @Deprecated
- void loggingFileAndPathWithDeprecatedProperties() {
- Map properties = new LinkedHashMap<>();
- properties.put("logging.file", "log.file");
- properties.put("logging.path", "logpath");
- PropertyResolver resolver = getPropertyResolver(properties);
- testLoggingFileAndPath(resolver);
- }
-
private void testLoggingFileAndPath(PropertyResolver resolver) {
LogFile logFile = LogFile.get(resolver);
Properties properties = new Properties();