From d24720d9581fc69dad74e82c3f2ff0afce5a328d Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Tue, 4 Jan 2022 14:06:36 +0100 Subject: [PATCH] Polish "Expose OS information as an InfoContributor" See gh-28907 --- .../info/InfoContributorAutoConfiguration.java | 2 +- .../META-INF/additional-spring-configuration-metadata.json | 2 +- .../info/InfoContributorAutoConfigurationTests.java | 2 +- .../boot/actuate/info/OsInfoContributor.java | 2 +- .../boot/actuate/info/OsInfoContributorTests.java | 5 ++--- .../src/docs/asciidoc/actuator/endpoints.adoc | 6 +++--- .../src/main/java/org/springframework/boot/info/OsInfo.java | 2 +- .../java/org/springframework/boot/info/OsInfoTests.java | 2 +- 8 files changed, 11 insertions(+), 12 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/info/InfoContributorAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/info/InfoContributorAutoConfiguration.java index a453e16b3b8..32b68176e2c 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/info/InfoContributorAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/info/InfoContributorAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 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. diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json index f6a1a533f9f..782a13e319b 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -282,7 +282,7 @@ { "name": "management.info.os.enabled", "type": "java.lang.Boolean", - "description": "Whether to enable OS info.", + "description": "Whether to enable Operating System info.", "defaultValue": false }, { diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/info/InfoContributorAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/info/InfoContributorAutoConfigurationTests.java index 88b7740db23..faa2f8befe1 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/info/InfoContributorAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/info/InfoContributorAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 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. diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/info/OsInfoContributor.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/info/OsInfoContributor.java index 1014c0e781a..b7fe75347b0 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/info/OsInfoContributor.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/info/OsInfoContributor.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 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. diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/OsInfoContributorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/OsInfoContributorTests.java index 25435c7032c..333a683c464 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/OsInfoContributorTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/info/OsInfoContributorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 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. @@ -18,7 +18,6 @@ package org.springframework.boot.actuate.info; import org.junit.jupiter.api.Test; -import org.springframework.boot.info.JavaInfo; import org.springframework.boot.info.OsInfo; import static org.assertj.core.api.Assertions.assertThat; @@ -28,7 +27,7 @@ import static org.assertj.core.api.Assertions.assertThat; * * @author Jonatan Ivanov */ -public class OsInfoContributorTests { +class OsInfoContributorTests { @Test void osInfoShouldBeAdded() { diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/endpoints.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/endpoints.adoc index f8301c67817..73a7bb283de 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/endpoints.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/endpoints.adoc @@ -1176,11 +1176,11 @@ When appropriate, Spring auto-configures the following `InfoContributor` beans: |=== -Whether or not an individual contributor is enabled is controlled by its `management.info..enabled` property. +Whether an individual contributor is enabled is controlled by its `management.info..enabled` property. Different contributors have different defaults for this property, depending on their prerequisites and the nature of the information that they expose. -With no prerequisites to indicate that they should be enabled, the `env`, `java` and `os` contributors are disabled by default. -You can enable them by setting the configprop:management.info.env.enabled[], configprop:management.info.java.enabled[] or configprop:management.info.os.enabled[] properties to `true`. +With no prerequisites to indicate that they should be enabled, the `env`, `java`, and `os` contributors are disabled by default. +Each can be enabled by setting its `management.info..enabled` property to `true`. The `build` and `git` info contributors are enabled by default. Each can be disabled by setting its `management.info..enabled` property to `false`. diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/info/OsInfo.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/info/OsInfo.java index 409da21fdb6..947628bf4ed 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/info/OsInfo.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/info/OsInfo.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 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. diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/info/OsInfoTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/info/OsInfoTests.java index 11e951b083b..14a3eaa96e7 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/info/OsInfoTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/info/OsInfoTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 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.