See gh-43498
This commit is contained in:
Johnny Lim 2024-12-13 23:40:38 +09:00 committed by Phillip Webb
parent e62bda9c04
commit 4d15ee5bf0
12 changed files with 52 additions and 50 deletions

View File

@ -43,7 +43,7 @@ None of these is essential for a pull request, but they will all help. They can
added after the original pull request but before a merge. added after the original pull request but before a merge.
* We use the https://github.com/spring-io/spring-javaformat/[Spring JavaFormat] project to apply code formatting conventions. * We use the https://github.com/spring-io/spring-javaformat/[Spring JavaFormat] project to apply code formatting conventions.
If you use Eclipse and you follow the https://github.com/spring-projects/spring-boot/wiki/Working-with-the-Code#importing-into-eclipse["Importing into eclipse"] instructions you should get project specific formatting automatically. If you use Eclipse and you follow the https://github.com/spring-projects/spring-boot/wiki/Working-with-the-Code#importing-into-eclipse["Importing into Eclipse"] instructions you should get project-specific formatting automatically.
You can also install the https://github.com/spring-io/spring-javaformat/#intellij-idea[Spring JavaFormat IntelliJ Plugin] or format the code from the Gradle build by running `./gradlew format`. You can also install the https://github.com/spring-io/spring-javaformat/#intellij-idea[Spring JavaFormat IntelliJ Plugin] or format the code from the Gradle build by running `./gradlew format`.
Note that if you have format violations in `buildSrc`, you can fix them by running `./gradlew -p buildSrc format` from the project root directory. Note that if you have format violations in `buildSrc`, you can fix them by running `./gradlew -p buildSrc format` from the project root directory.
* The build includes Checkstyle rules for many of our code conventions. Run `./gradlew checkstyleMain checkstyleTest` if you want to check your changes are compliant. * The build includes Checkstyle rules for many of our code conventions. Run `./gradlew checkstyleMain checkstyleTest` if you want to check your changes are compliant.

View File

@ -216,7 +216,7 @@ public abstract class CheckBom extends DefaultTask {
.getResolvedConfiguration() .getResolvedConfiguration()
.getResolvedArtifacts(); .getResolvedArtifacts();
if (artifacts.size() != 1) { if (artifacts.size() != 1) {
throw new IllegalStateException("Expected a single file but '%s' resolved to %d artifacts" throw new IllegalStateException("Expected a single artifact but '%s' resolved to %d artifacts"
.formatted(coordinates, artifacts.size())); .formatted(coordinates, artifacts.size()));
} }
return artifacts.iterator().next().getFile(); return artifacts.iterator().next().getFile();

View File

@ -42,12 +42,13 @@ class OnEnabledLoggingExportCondition extends SpringBootCondition {
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
String loggingExporter = getExporterName(metadata); String loggingExporter = getExporterName(metadata);
if (StringUtils.hasLength(loggingExporter)) { if (StringUtils.hasLength(loggingExporter)) {
String formattedExporterProperty = EXPORTER_PROPERTY.formatted(loggingExporter);
Boolean exporterLoggingEnabled = context.getEnvironment() Boolean exporterLoggingEnabled = context.getEnvironment()
.getProperty(EXPORTER_PROPERTY.formatted(loggingExporter), Boolean.class); .getProperty(formattedExporterProperty, Boolean.class);
if (exporterLoggingEnabled != null) { if (exporterLoggingEnabled != null) {
return new ConditionOutcome(exporterLoggingEnabled, return new ConditionOutcome(exporterLoggingEnabled,
ConditionMessage.forCondition(ConditionalOnEnabledLoggingExport.class) ConditionMessage.forCondition(ConditionalOnEnabledLoggingExport.class)
.because(EXPORTER_PROPERTY.formatted(loggingExporter) + " is " + exporterLoggingEnabled)); .because(formattedExporterProperty + " is " + exporterLoggingEnabled));
} }
} }
Boolean globalLoggingEnabled = context.getEnvironment().getProperty(GLOBAL_PROPERTY, Boolean.class); Boolean globalLoggingEnabled = context.getEnvironment().getProperty(GLOBAL_PROPERTY, Boolean.class);

View File

@ -209,8 +209,8 @@ If multiple clients are available on the classpath, and not global configuration
[[io.rest-client.clienthttprequestfactory.configuration]] [[io.rest-client.clienthttprequestfactory.configuration]]
=== Global HTTP Client Configuration === Global HTTP Client Configuration
If the the auto-detected HTTP client does not meet your needs, you can use the configprop:spring.http.client.factory[] property to pick a specific factory. If the auto-detected HTTP client does not meet your needs, you can use the configprop:spring.http.client.factory[] property to pick a specific factory.
For example, if you have Apache HttpClient on your classpath, but you prefer Jetty's javadoc:org.eclipse.jetty.client.HttpClient[] you can add use the following: For example, if you have Apache HttpClient on your classpath, but you prefer Jetty's javadoc:org.eclipse.jetty.client.HttpClient[] you can add the following:
[configprops,yaml] [configprops,yaml]
---- ----

View File

@ -10,7 +10,7 @@ import java.net.http.HttpClient
class MyClientHttpConfiguration { class MyClientHttpConfiguration {
@Bean @Bean
fun clientHttpRequestFactoryBuilder(proxySelector: ProxySelector): ClientHttpRequestFactoryBuilder<*>? { fun clientHttpRequestFactoryBuilder(proxySelector: ProxySelector): ClientHttpRequestFactoryBuilder<*> {
return ClientHttpRequestFactoryBuilder.jdk() return ClientHttpRequestFactoryBuilder.jdk()
.withHttpClientCustomizer { builder -> builder.proxy(proxySelector) } .withHttpClientCustomizer { builder -> builder.proxy(proxySelector) }
} }

View File

@ -59,7 +59,7 @@ public class ExampleJsonComponent {
protected ExampleCustomObject deserializeObject(JsonParser jsonParser, DeserializationContext context, protected ExampleCustomObject deserializeObject(JsonParser jsonParser, DeserializationContext context,
ObjectCodec codec, JsonNode tree) throws IOException { ObjectCodec codec, JsonNode tree) throws IOException {
String value = nullSafeValue(tree.get("value"), String.class); String value = nullSafeValue(tree.get("value"), String.class);
Date date = nullSafeValue(tree.get("date"), Integer.class, Date::new); Date date = nullSafeValue(tree.get("date"), Long.class, Date::new);
UUID uuid = nullSafeValue(tree.get("uuid"), String.class, UUID::fromString); UUID uuid = nullSafeValue(tree.get("uuid"), String.class, UUID::fromString);
return new ExampleCustomObject(value, date, uuid); return new ExampleCustomObject(value, date, uuid);
} }

View File

@ -149,9 +149,9 @@ public class Instantiator<T> {
} }
/** /**
* Instantiate the given set of classes, injecting constructor arguments as necessary. * Instantiate the given class, injecting constructor arguments as necessary.
* @param type the types to instantiate * @param type the type to instantiate
* @return a list of instantiated instances * @return an instantiated instance
* @since 3.4.0 * @since 3.4.0
*/ */
public T instantiateType(Class<?> type) { public T instantiateType(Class<?> type) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -116,8 +116,9 @@ class EmbeddedServerContainerInvocationContextProvider
private AbstractApplicationLauncher getAbstractApplicationLauncher(Application application, private AbstractApplicationLauncher getAbstractApplicationLauncher(Application application,
Class<? extends AbstractApplicationLauncher> launcherClass) { Class<? extends AbstractApplicationLauncher> launcherClass) {
String cacheKey = application.getContainer() + ":" + application.getPackaging() + ":" + launcherClass.getName(); String cacheKey = application.getContainer() + ":" + application.getPackaging() + ":" + launcherClass.getName();
if (this.launcherCache.containsKey(cacheKey)) { AbstractApplicationLauncher cachedLauncher = this.launcherCache.get(cacheKey);
return this.launcherCache.get(cacheKey); if (cachedLauncher != null) {
return cachedLauncher;
} }
AbstractApplicationLauncher launcher = ReflectionUtils.newInstance(launcherClass, application, AbstractApplicationLauncher launcher = ReflectionUtils.newInstance(launcherClass, application,
new File(buildOutput.getRootLocation(), "app-launcher-" + UUID.randomUUID())); new File(buildOutput.getRootLocation(), "app-launcher-" + UUID.randomUUID()));