Merge pull request #44034 from izeye

* pr/44034:
  Polish

Closes gh-44034
This commit is contained in:
Stéphane Nicoll 2025-01-31 17:05:07 +01:00
commit 44403af9be
10 changed files with 23 additions and 32 deletions

View File

@ -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 {
}
@Test
void shouldUseUrlSenderIfHttpSenderIsNotAvailable() {
void shouldUseUrlConnectionSenderIfHttpClientIsNotAvailable() {
this.contextRunner.withUserConfiguration(UrlConnectionSenderConfiguration.class)
.withClassLoader(new FilteredClassLoader(HttpClient.class))
.run((context) -> {
@ -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 {

View File

@ -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()));

View File

@ -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.
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:
| 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.
|===

View File

@ -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;
}

View File

@ -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;
}

View File

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

View File

@ -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));
});
}

View File

@ -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")

View File

@ -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 {
}
@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 {
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) {

View File

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