mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Inject InfoContributors instead of exposing them on InfoEndpoint
Closes gh-13586
This commit is contained in:
parent
2cdc93cf19
commit
223f2be7d2
@ -24,6 +24,7 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.boot.actuate.autoconfigure.cloudfoundry.CloudFoundryWebEndpointDiscoverer;
|
||||
import org.springframework.boot.actuate.autoconfigure.cloudfoundry.servlet.CloudFoundryInfoEndpointWebExtension;
|
||||
@ -99,9 +100,8 @@ public class ReactiveCloudFoundryActuatorAutoConfiguration {
|
||||
@ConditionalOnExposedEndpoint
|
||||
@ConditionalOnBean({ InfoEndpoint.class, GitProperties.class })
|
||||
public CloudFoundryInfoEndpointWebExtension cloudFoundryInfoEndpointWebExtension(
|
||||
InfoEndpoint infoEndpoint, GitProperties properties) {
|
||||
List<InfoContributor> existingContributors = infoEndpoint.getInfoContributors();
|
||||
List<InfoContributor> contributors = existingContributors.stream()
|
||||
GitProperties properties, ObjectProvider<InfoContributor> infoContributors) {
|
||||
List<InfoContributor> contributors = infoContributors.orderedStream()
|
||||
.map((infoContributor) -> {
|
||||
if (infoContributor instanceof GitInfoContributor) {
|
||||
return new GitInfoContributor(properties,
|
||||
|
@ -23,6 +23,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.actuate.autoconfigure.cloudfoundry.CloudFoundryWebEndpointDiscoverer;
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnEnabledEndpoint;
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnExposedEndpoint;
|
||||
@ -100,9 +101,8 @@ public class CloudFoundryActuatorAutoConfiguration {
|
||||
@ConditionalOnExposedEndpoint
|
||||
@ConditionalOnBean({ InfoEndpoint.class, GitProperties.class })
|
||||
public CloudFoundryInfoEndpointWebExtension cloudFoundryInfoEndpointWebExtension(
|
||||
InfoEndpoint infoEndpoint, GitProperties properties) {
|
||||
List<InfoContributor> existingContributors = infoEndpoint.getInfoContributors();
|
||||
List<InfoContributor> contributors = existingContributors.stream()
|
||||
GitProperties properties, ObjectProvider<InfoContributor> infoContributors) {
|
||||
List<InfoContributor> contributors = infoContributors.orderedStream()
|
||||
.map((infoContributor) -> {
|
||||
if (infoContributor instanceof GitInfoContributor) {
|
||||
return new GitInfoContributor(properties,
|
||||
|
@ -55,8 +55,4 @@ public class InfoEndpoint {
|
||||
return build.getDetails();
|
||||
}
|
||||
|
||||
public List<InfoContributor> getInfoContributors() {
|
||||
return this.infoContributors;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user