Merge pull request #43498 from izeye
* pr/43498: Polish Closes gh-43498
This commit is contained in:
commit
c891775a49
|
|
@ -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.
|
||||
|
||||
* 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`.
|
||||
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.
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ public abstract class CheckBom extends DefaultTask {
|
|||
.getResolvedConfiguration()
|
||||
.getResolvedArtifacts();
|
||||
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()));
|
||||
}
|
||||
return artifacts.iterator().next().getFile();
|
||||
|
|
|
|||
|
|
@ -42,12 +42,13 @@ class OnEnabledLoggingExportCondition extends SpringBootCondition {
|
|||
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
|
||||
String loggingExporter = getExporterName(metadata);
|
||||
if (StringUtils.hasLength(loggingExporter)) {
|
||||
String formattedExporterProperty = EXPORTER_PROPERTY.formatted(loggingExporter);
|
||||
Boolean exporterLoggingEnabled = context.getEnvironment()
|
||||
.getProperty(EXPORTER_PROPERTY.formatted(loggingExporter), Boolean.class);
|
||||
.getProperty(formattedExporterProperty, Boolean.class);
|
||||
if (exporterLoggingEnabled != null) {
|
||||
return new ConditionOutcome(exporterLoggingEnabled,
|
||||
ConditionMessage.forCondition(ConditionalOnEnabledLoggingExport.class)
|
||||
.because(EXPORTER_PROPERTY.formatted(loggingExporter) + " is " + exporterLoggingEnabled));
|
||||
.because(formattedExporterProperty + " is " + exporterLoggingEnabled));
|
||||
}
|
||||
}
|
||||
Boolean globalLoggingEnabled = context.getEnvironment().getProperty(GLOBAL_PROPERTY, Boolean.class);
|
||||
|
|
|
|||
|
|
@ -209,8 +209,8 @@ If multiple clients are available on the classpath, and not global configuration
|
|||
[[io.rest-client.clienthttprequestfactory.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.
|
||||
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:
|
||||
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 the following:
|
||||
|
||||
[configprops,yaml]
|
||||
----
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import java.net.http.HttpClient
|
|||
class MyClientHttpConfiguration {
|
||||
|
||||
@Bean
|
||||
fun clientHttpRequestFactoryBuilder(proxySelector: ProxySelector): ClientHttpRequestFactoryBuilder<*>? {
|
||||
fun clientHttpRequestFactoryBuilder(proxySelector: ProxySelector): ClientHttpRequestFactoryBuilder<*> {
|
||||
return ClientHttpRequestFactoryBuilder.jdk()
|
||||
.withHttpClientCustomizer { builder -> builder.proxy(proxySelector) }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ public class ExampleJsonComponent {
|
|||
protected ExampleCustomObject deserializeObject(JsonParser jsonParser, DeserializationContext context,
|
||||
ObjectCodec codec, JsonNode tree) throws IOException {
|
||||
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);
|
||||
return new ExampleCustomObject(value, date, uuid);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,9 +149,9 @@ public class Instantiator<T> {
|
|||
}
|
||||
|
||||
/**
|
||||
* Instantiate the given set of classes, injecting constructor arguments as necessary.
|
||||
* @param type the types to instantiate
|
||||
* @return a list of instantiated instances
|
||||
* Instantiate the given class, injecting constructor arguments as necessary.
|
||||
* @param type the type to instantiate
|
||||
* @return an instantiated instance
|
||||
* @since 3.4.0
|
||||
*/
|
||||
public T instantiateType(Class<?> type) {
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
|||
|
|
@ -116,8 +116,9 @@ class EmbeddedServerContainerInvocationContextProvider
|
|||
private AbstractApplicationLauncher getAbstractApplicationLauncher(Application application,
|
||||
Class<? extends AbstractApplicationLauncher> launcherClass) {
|
||||
String cacheKey = application.getContainer() + ":" + application.getPackaging() + ":" + launcherClass.getName();
|
||||
if (this.launcherCache.containsKey(cacheKey)) {
|
||||
return this.launcherCache.get(cacheKey);
|
||||
AbstractApplicationLauncher cachedLauncher = this.launcherCache.get(cacheKey);
|
||||
if (cachedLauncher != null) {
|
||||
return cachedLauncher;
|
||||
}
|
||||
AbstractApplicationLauncher launcher = ReflectionUtils.newInstance(launcherClass, application,
|
||||
new File(buildOutput.getRootLocation(), "app-launcher-" + UUID.randomUUID()));
|
||||
|
|
|
|||
Loading…
Reference in New Issue