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

@ -1,21 +1,21 @@
CREATE TABLE PREFIX_JOB_INSTANCE ( CREATE TABLE PREFIX_JOB_INSTANCE (
JOB_INSTANCE_ID BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY , JOB_INSTANCE_ID BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
VERSION BIGINT , VERSION BIGINT,
JOB_NAME VARCHAR(100) NOT NULL, JOB_NAME VARCHAR(100) NOT NULL,
JOB_KEY VARCHAR(32) NOT NULL, JOB_KEY VARCHAR(32) NOT NULL,
constraint JOB_INST_UN unique (JOB_NAME, JOB_KEY) constraint JOB_INST_UN unique (JOB_NAME, JOB_KEY)
) ; ) ;
CREATE TABLE PREFIX_JOB_EXECUTION ( CREATE TABLE PREFIX_JOB_EXECUTION (
JOB_EXECUTION_ID BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY , JOB_EXECUTION_ID BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
VERSION BIGINT , VERSION BIGINT,
JOB_INSTANCE_ID BIGINT NOT NULL, JOB_INSTANCE_ID BIGINT NOT NULL,
CREATE_TIME TIMESTAMP NOT NULL, CREATE_TIME TIMESTAMP NOT NULL,
START_TIME TIMESTAMP DEFAULT NULL , START_TIME TIMESTAMP DEFAULT NULL,
END_TIME TIMESTAMP DEFAULT NULL , END_TIME TIMESTAMP DEFAULT NULL,
STATUS VARCHAR(10) , STATUS VARCHAR(10),
EXIT_CODE VARCHAR(2500) , EXIT_CODE VARCHAR(2500),
EXIT_MESSAGE VARCHAR(2500) , EXIT_MESSAGE VARCHAR(2500),
LAST_UPDATED TIMESTAMP, LAST_UPDATED TIMESTAMP,
JOB_CONFIGURATION_LOCATION VARCHAR(2500) NULL, JOB_CONFIGURATION_LOCATION VARCHAR(2500) NULL,
constraint JOB_INST_EXEC_FK foreign key (JOB_INSTANCE_ID) constraint JOB_INST_EXEC_FK foreign key (JOB_INSTANCE_ID)
@ -23,36 +23,36 @@ CREATE TABLE PREFIX_JOB_EXECUTION (
) ; ) ;
CREATE TABLE PREFIX_JOB_EXECUTION_PARAMS ( CREATE TABLE PREFIX_JOB_EXECUTION_PARAMS (
JOB_EXECUTION_ID BIGINT NOT NULL , JOB_EXECUTION_ID BIGINT NOT NULL,
TYPE_CD VARCHAR(6) NOT NULL , TYPE_CD VARCHAR(6) NOT NULL,
KEY_NAME VARCHAR(100) NOT NULL , KEY_NAME VARCHAR(100) NOT NULL,
STRING_VAL VARCHAR(250) , STRING_VAL VARCHAR(250),
DATE_VAL TIMESTAMP DEFAULT NULL , DATE_VAL TIMESTAMP DEFAULT NULL,
LONG_VAL BIGINT , LONG_VAL BIGINT,
DOUBLE_VAL DOUBLE PRECISION , DOUBLE_VAL DOUBLE PRECISION,
IDENTIFYING CHAR(1) NOT NULL , IDENTIFYING CHAR(1) NOT NULL,
constraint JOB_EXEC_PARAMS_FK foreign key (JOB_EXECUTION_ID) constraint JOB_EXEC_PARAMS_FK foreign key (JOB_EXECUTION_ID)
references PREFIX_JOB_EXECUTION(JOB_EXECUTION_ID) references PREFIX_JOB_EXECUTION(JOB_EXECUTION_ID)
) ; ) ;
CREATE TABLE PREFIX_STEP_EXECUTION ( CREATE TABLE PREFIX_STEP_EXECUTION (
STEP_EXECUTION_ID BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY , STEP_EXECUTION_ID BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
VERSION BIGINT NOT NULL, VERSION BIGINT NOT NULL,
STEP_NAME VARCHAR(100) NOT NULL, STEP_NAME VARCHAR(100) NOT NULL,
JOB_EXECUTION_ID BIGINT NOT NULL, JOB_EXECUTION_ID BIGINT NOT NULL,
START_TIME TIMESTAMP NOT NULL , START_TIME TIMESTAMP NOT NULL,
END_TIME TIMESTAMP DEFAULT NULL , END_TIME TIMESTAMP DEFAULT NULL,
STATUS VARCHAR(10) , STATUS VARCHAR(10),
COMMIT_COUNT BIGINT , COMMIT_COUNT BIGINT,
READ_COUNT BIGINT , READ_COUNT BIGINT,
FILTER_COUNT BIGINT , FILTER_COUNT BIGINT,
WRITE_COUNT BIGINT , WRITE_COUNT BIGINT,
READ_SKIP_COUNT BIGINT , READ_SKIP_COUNT BIGINT,
WRITE_SKIP_COUNT BIGINT , WRITE_SKIP_COUNT BIGINT,
PROCESS_SKIP_COUNT BIGINT , PROCESS_SKIP_COUNT BIGINT,
ROLLBACK_COUNT BIGINT , ROLLBACK_COUNT BIGINT,
EXIT_CODE VARCHAR(2500) , EXIT_CODE VARCHAR(2500),
EXIT_MESSAGE VARCHAR(2500) , EXIT_MESSAGE VARCHAR(2500),
LAST_UPDATED TIMESTAMP, LAST_UPDATED TIMESTAMP,
constraint JOB_EXEC_STEP_FK foreign key (JOB_EXECUTION_ID) constraint JOB_EXEC_STEP_FK foreign key (JOB_EXECUTION_ID)
references PREFIX_JOB_EXECUTION(JOB_EXECUTION_ID) references PREFIX_JOB_EXECUTION(JOB_EXECUTION_ID)
@ -61,7 +61,7 @@ CREATE TABLE PREFIX_STEP_EXECUTION (
CREATE TABLE PREFIX_STEP_EXECUTION_CONTEXT ( CREATE TABLE PREFIX_STEP_EXECUTION_CONTEXT (
STEP_EXECUTION_ID BIGINT NOT NULL PRIMARY KEY, STEP_EXECUTION_ID BIGINT NOT NULL PRIMARY KEY,
SHORT_CONTEXT VARCHAR(2500) NOT NULL, SHORT_CONTEXT VARCHAR(2500) NOT NULL,
SERIALIZED_CONTEXT LONGVARCHAR , SERIALIZED_CONTEXT LONGVARCHAR,
constraint STEP_EXEC_CTX_FK foreign key (STEP_EXECUTION_ID) constraint STEP_EXEC_CTX_FK foreign key (STEP_EXECUTION_ID)
references PREFIX_STEP_EXECUTION(STEP_EXECUTION_ID) references PREFIX_STEP_EXECUTION(STEP_EXECUTION_ID)
) ; ) ;
@ -69,7 +69,7 @@ CREATE TABLE PREFIX_STEP_EXECUTION_CONTEXT (
CREATE TABLE PREFIX_JOB_EXECUTION_CONTEXT ( CREATE TABLE PREFIX_JOB_EXECUTION_CONTEXT (
JOB_EXECUTION_ID BIGINT NOT NULL PRIMARY KEY, JOB_EXECUTION_ID BIGINT NOT NULL PRIMARY KEY,
SHORT_CONTEXT VARCHAR(2500) NOT NULL, SHORT_CONTEXT VARCHAR(2500) NOT NULL,
SERIALIZED_CONTEXT LONGVARCHAR , SERIALIZED_CONTEXT LONGVARCHAR,
constraint JOB_EXEC_CTX_FK foreign key (JOB_EXECUTION_ID) constraint JOB_EXEC_CTX_FK foreign key (JOB_EXECUTION_ID)
references PREFIX_JOB_EXECUTION(JOB_EXECUTION_ID) references PREFIX_JOB_EXECUTION(JOB_EXECUTION_ID)
) ; ) ;

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

@ -786,7 +786,7 @@ public class JSONObject {
/** /**
* Wraps the given object if necessary. * Wraps the given object if necessary.
* <p> * <p>
* If the object is null or , returns {@link #NULL}. If the object is a * If the object is null or, returns {@link #NULL}. If the object is a
* {@code JSONArray} or {@code JSONObject}, no wrapping is necessary. If the object is * {@code JSONArray} or {@code JSONObject}, no wrapping is necessary. If the object is
* {@code NULL}, no wrapping is necessary. If the object is an array or * {@code NULL}, no wrapping is necessary. If the object is an array or
* {@code Collection}, returns an equivalent {@code JSONArray}. If the object is a * {@code Collection}, returns an equivalent {@code JSONArray}. If the object is a

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

@ -438,7 +438,7 @@ public class RestTemplateBuilder {
/** /**
* Sets the {@link ClientHttpRequestFactorySettings}. This will replace any previously * Sets the {@link ClientHttpRequestFactorySettings}. This will replace any previously
* set {@link #connectTimeout(Duration) connectTimeout} ,{@link #readTimeout(Duration) * set {@link #connectTimeout(Duration) connectTimeout}, {@link #readTimeout(Duration)
* readTimeout} and {@link #sslBundle(SslBundle) sslBundle} values. * readTimeout} and {@link #sslBundle(SslBundle) sslBundle} values.
* @param requestFactorySettings the request factory settings * @param requestFactorySettings the request factory settings
* @return a new builder instance * @return a new builder instance

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.
@ -39,7 +39,7 @@ import org.springframework.util.StringUtils;
* {@link Value @Value} or obtained through the {@link Environment}. * {@link Value @Value} or obtained through the {@link Environment}.
* <p> * <p>
* If the {@link WebServerInitializedEvent} has a * If the {@link WebServerInitializedEvent} has a
* {@link WebServerApplicationContext#getServerNamespace() server namespace} , it will be * {@link WebServerApplicationContext#getServerNamespace() server namespace}, it will be
* used to construct the property name. For example, the "management" actuator context * used to construct the property name. For example, the "management" actuator context
* will have the property name {@literal "local.management.port"}. * will have the property name {@literal "local.management.port"}.
* <p> * <p>

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