Browse Source

Merge pull request #44034 from izeye

* pr/44034:
  Polish

Closes gh-44034
pull/44040/head
Stéphane Nicoll 1 year ago
parent
commit
44403af9be
  1. 14
      spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/tracing/zipkin/ZipkinConfigurationsSenderConfigurationTests.java
  2. 6
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/graphql/DefaultGraphQlSchemaCondition.java
  3. 8
      spring-boot-project/spring-boot-docs/src/docs/antora/modules/specification/pages/configuration-metadata/format.adoc
  4. 6
      spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemIgnore.java
  5. 5
      spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/JsonMarshaller.java
  6. 4
      spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/metadata/JsonMarshallerTests.java
  7. 2
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/StandardConfigDataLocationResolver.java
  8. 2
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/info/ProcessInfo.java
  9. 6
      spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/StandardConfigDataLocationResolverTests.java
  10. 2
      spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/structured/StructuredLoggingJsonPropertiesTests.java

14
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/tracing/zipkin/ZipkinConfigurationsSenderConfigurationTests.java

@ -47,7 +47,7 @@ class ZipkinConfigurationsSenderConfigurationTests { @@ -47,7 +47,7 @@ class ZipkinConfigurationsSenderConfigurationTests {
.withConfiguration(AutoConfigurations.of(DefaultEncodingConfiguration.class, SenderConfiguration.class));
@Test
void shouldSupplyDefaultHttpClientSenderBeans() {
void shouldSupplyDefaultHttpClientSenderBean() {
this.contextRunner.run((context) -> {
assertThat(context).hasSingleBean(BytesMessageSender.class);
assertThat(context).hasSingleBean(ZipkinHttpClientSender.class);
@ -56,7 +56,7 @@ class ZipkinConfigurationsSenderConfigurationTests { @@ -56,7 +56,7 @@ class ZipkinConfigurationsSenderConfigurationTests {
}
@Test
void shouldUseUrlSenderIfHttpSenderIsNotAvailable() {
void shouldUseUrlConnectionSenderIfHttpClientIsNotAvailable() {
this.contextRunner.withUserConfiguration(UrlConnectionSenderConfiguration.class)
.withClassLoader(new FilteredClassLoader(HttpClient.class))
.run((context) -> {
@ -85,16 +85,6 @@ class ZipkinConfigurationsSenderConfigurationTests { @@ -85,16 +85,6 @@ class ZipkinConfigurationsSenderConfigurationTests {
});
}
@Configuration(proxyBeanMethods = false)
private static final class HttpClientConfiguration {
@Bean
ZipkinHttpClientBuilderCustomizer httpClientBuilderCustomizer() {
return mock(ZipkinHttpClientBuilderCustomizer.class);
}
}
@Configuration(proxyBeanMethods = false)
private static final class CustomConfiguration {

6
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/graphql/DefaultGraphQlSchemaCondition.java

@ -84,10 +84,10 @@ class DefaultGraphQlSchemaCondition extends SpringBootCondition implements Confi @@ -84,10 +84,10 @@ class DefaultGraphQlSchemaCondition extends SpringBootCondition implements Confi
else {
messages.add((message.didNotFind("GraphQlSourceBuilderCustomizer").atAll()));
}
String[] graphqlSourceBeans = beanFactory.getBeanNamesForType(GraphQlSource.class, false, false);
if (graphqlSourceBeans.length != 0) {
String[] graphQlSourceBeanNames = beanFactory.getBeanNamesForType(GraphQlSource.class, false, false);
if (graphQlSourceBeanNames.length != 0) {
match = true;
messages.add(message.found("graphqlSource").items(Arrays.asList(graphqlSourceBeans)));
messages.add(message.found("GraphQlSource").items(Arrays.asList(graphQlSourceBeanNames)));
}
else {
messages.add((message.didNotFind("GraphQlSource").atAll()));

8
spring-boot-project/spring-boot-docs/src/docs/antora/modules/specification/pages/configuration-metadata/format.adoc

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
= Metadata Format
Configuration metadata files are located inside jars under `META-INF/spring-configuration-metadata.json`.
They use a JSON format with items categorized under either "`groups`" or "`properties`", additional values hints categorized under "hints", and ignored items under "`ignored`" as shown in the following example:
They use a JSON format with items categorized under either "`groups`" or "`properties`", additional values hints categorized under "`hints`", and ignored items under "`ignored`" as shown in the following example:
[source,json]
----
@ -93,7 +93,7 @@ Some properties might exist in their own right. @@ -93,7 +93,7 @@ Some properties might exist in their own right.
The "`hints`" are additional information used to assist the user in configuring a given property.
For example, when a developer is configuring the configprop:spring.jpa.hibernate.ddl-auto[] property, a tool can use the hints to offer some auto-completion help for the `none`, `validate`, `update`, `create`, and `create-drop` values.
Finally, "`ignored`" are items which have been deliberately ignored.
Finally, "`ignored`" is for items which have been deliberately ignored.
The content of this section usually comes from the xref:specification:configuration-metadata/annotation-processor.adoc#appendix.configuration-metadata.annotation-processor.adding-additional-metadata[additional metadata].
@ -313,8 +313,8 @@ The `ignored` object can contain the attributes shown in the following table: @@ -313,8 +313,8 @@ The `ignored` object can contain the attributes shown in the following table:
| Name | Type | Purpose
| `properties`
| IgnoredProperty[]
| A list of ignored properties as defined by the IgnoredProperty object (described in the next table). Each entry defines the name of the ignored property.
| ItemIgnore[]
| A list of ignored properties as defined by the ItemIgnore object (described in the next table). Each entry defines the name of the ignored property.
|===

6
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemIgnore.java

@ -33,12 +33,12 @@ public final class ItemIgnore implements Comparable<ItemIgnore> { @@ -33,12 +33,12 @@ public final class ItemIgnore implements Comparable<ItemIgnore> {
private final String name;
private ItemIgnore(ItemType type, String name) {
if (name == null) {
throw new IllegalArgumentException("'name' must not be null");
}
if (type == null) {
throw new IllegalArgumentException("'type' must not be null");
}
if (name == null) {
throw new IllegalArgumentException("'name' must not be null");
}
this.type = type;
this.name = name;
}

5
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/JsonMarshaller.java

@ -92,8 +92,9 @@ public class JsonMarshaller { @@ -92,8 +92,9 @@ public class JsonMarshaller {
}
JSONObject ignored = object.optJSONObject("ignored");
if (ignored != null) {
checkAllowedKeys(ignored, path.resolve("ignored"), "properties");
addIgnoredProperties(metadata, ignored, path.resolve("ignored"));
JsonPath ignoredPath = path.resolve("ignored");
checkAllowedKeys(ignored, ignoredPath, "properties");
addIgnoredProperties(metadata, ignored, ignoredPath);
}
return metadata;
}

4
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/metadata/JsonMarshallerTests.java

@ -348,7 +348,7 @@ class JsonMarshallerTests { @@ -348,7 +348,7 @@ class JsonMarshallerTests {
}
@Test
void shouldCheckIgnoreFields() {
void shouldCheckIgnoredFields() {
String json = """
{
"ignored": {
@ -362,7 +362,7 @@ class JsonMarshallerTests { @@ -362,7 +362,7 @@ class JsonMarshallerTests {
}
@Test
void shouldCheckIgnorePropertiesFields() {
void shouldCheckIgnoredPropertiesFields() {
String json = """
{
"ignored": {

2
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/StandardConfigDataLocationResolver.java

@ -182,7 +182,7 @@ public class StandardConfigDataLocationResolver @@ -182,7 +182,7 @@ public class StandardConfigDataLocationResolver
return;
}
throw new IllegalStateException(
String.format("Invalid profile '%s': must contain only letters or digits or '-' or '_'", profile));
String.format("Invalid profile '%s': must contain only letters, digits, '-', or '_'", profile));
});
}

2
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/info/ProcessInfo.java

@ -88,7 +88,7 @@ public class ProcessInfo { @@ -88,7 +88,7 @@ public class ProcessInfo {
* threads, the parallelism level, and the thread pool size.
* @return an instance of {@link VirtualThreadsInfo} containing information about
* virtual threads, or {@code null} if the VirtualThreadSchedulerMXBean is not
* available.
* available
* @since 3.5.0
*/
@SuppressWarnings("unchecked")

6
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/StandardConfigDataLocationResolverTests.java

@ -322,7 +322,7 @@ class StandardConfigDataLocationResolverTests { @@ -322,7 +322,7 @@ class StandardConfigDataLocationResolverTests {
}
@Test
void resolveProfileSpecificWhenProfileStartsWithSymbolThrowsException() {
void resolveProfileSpecificWhenProfileStartsWithDashThrowsException() {
ConfigDataLocation location = ConfigDataLocation.of("classpath:/configdata/properties/");
this.environment.setActiveProfiles("-dev");
Profiles profiles = new Profiles(this.environment, this.environmentBinder, Collections.emptyList());
@ -342,7 +342,7 @@ class StandardConfigDataLocationResolverTests { @@ -342,7 +342,7 @@ class StandardConfigDataLocationResolverTests {
}
@Test
void resolveProfileSpecificWhenProfileEndsWithSymbolThrowsException() {
void resolveProfileSpecificWhenProfileEndsWithDashThrowsException() {
ConfigDataLocation location = ConfigDataLocation.of("classpath:/configdata/properties/");
this.environment.setActiveProfiles("dev-");
Profiles profiles = new Profiles(this.environment, this.environmentBinder, Collections.emptyList());
@ -368,7 +368,7 @@ class StandardConfigDataLocationResolverTests { @@ -368,7 +368,7 @@ class StandardConfigDataLocationResolverTests {
Profiles profiles = new Profiles(this.environment, this.environmentBinder, Collections.emptyList());
assertThatIllegalStateException()
.isThrownBy(() -> this.resolver.resolveProfileSpecific(this.context, location, profiles))
.withMessageStartingWith("Invalid profile 'dev*test': must contain only letters or digits or '-' or '_'");
.withMessageStartingWith("Invalid profile 'dev*test': must contain only letters, digits, '-', or '_'");
}
private String filePath(String... components) {

2
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/structured/StructuredLoggingJsonPropertiesTests.java

@ -69,7 +69,7 @@ class StructuredLoggingJsonPropertiesTests { @@ -69,7 +69,7 @@ class StructuredLoggingJsonPropertiesTests {
}
@Test
void structuredLoggingJsonPropertiesRuntimeHintsRuntimeHintsIsRegistered() {
void structuredLoggingJsonPropertiesRuntimeHintsIsRegistered() {
assertThat(AotServices.factories().load(RuntimeHintsRegistrar.class))
.anyMatch(StructuredLoggingJsonPropertiesRuntimeHints.class::isInstance);
}

Loading…
Cancel
Save