Browse Source

Polish

pull/47334/head
Andy Wilkinson 3 months ago
parent
commit
51b606e941
  1. 4
      buildSrc/src/test/java/org/springframework/boot/build/bom/bomr/version/DependencyVersionUpgradeTests.java
  2. 4
      core/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextCloserApplicationListener.java
  3. 7
      core/spring-boot/src/main/java/org/springframework/boot/convert/ApplicationConversionService.java
  4. 8
      core/spring-boot/src/main/java/org/springframework/boot/retry/RetryPolicySettings.java
  5. 10
      core/spring-boot/src/main/java/org/springframework/boot/task/SimpleAsyncTaskExecutorBuilder.java
  6. 1
      core/spring-boot/src/test/java/org/springframework/boot/context/metrics/buffering/BufferingApplicationStartupTests.java
  7. 2
      documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/messaging/kafka/streams/MyKafkaStreamsConfiguration.java
  8. 12
      module/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/info/InfoPropertiesInfoContributor.java
  9. 7
      module/spring-boot-graphql/src/main/java/org/springframework/boot/graphql/autoconfigure/GraphQlAutoConfiguration.java
  10. 5
      module/spring-boot-jetty/src/main/java/org/springframework/boot/jetty/JettyHandlerWrappers.java
  11. 4
      smoke-test/spring-boot-smoke-test-web-secure-jdbc/src/main/java/smoketest/web/secure/jdbc/SampleWebSecureJdbcApplication.java

4
buildSrc/src/test/java/org/springframework/boot/build/bom/bomr/version/DependencyVersionUpgradeTests.java

@ -31,6 +31,7 @@ import org.junit.jupiter.params.ParameterizedTest; @@ -31,6 +31,7 @@ import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.ArgumentsProvider;
import org.junit.jupiter.params.provider.ArgumentsSource;
import org.junit.jupiter.params.support.ParameterDeclarations;
import static org.assertj.core.api.Assertions.assertThat;
@ -244,7 +245,8 @@ class DependencyVersionUpgradeTests { @@ -244,7 +245,8 @@ class DependencyVersionUpgradeTests {
static class InputProvider implements ArgumentsProvider {
@Override
public Stream<? extends Arguments> provideArguments(ExtensionContext context) {
public Stream<? extends Arguments> provideArguments(ParameterDeclarations parameterDeclarations,
ExtensionContext context) {
Method testMethod = context.getRequiredTestMethod();
Stream<Arguments> artifactVersions = artifactVersions(testMethod)
.map((artifactVersion) -> Arguments.of(VersionType.ARTIFACT_VERSION.parse(artifactVersion.current()),

4
core/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextCloserApplicationListener.java

@ -40,14 +40,14 @@ import org.springframework.util.ObjectUtils; @@ -40,14 +40,14 @@ import org.springframework.util.ObjectUtils;
public class ParentContextCloserApplicationListener
implements ApplicationListener<ParentContextAvailableEvent>, ApplicationContextAware, Ordered {
private static final int order = Ordered.LOWEST_PRECEDENCE - 10;
private static final int ORDER = Ordered.LOWEST_PRECEDENCE - 10;
@SuppressWarnings("NullAway.Init")
private ApplicationContext context;
@Override
public int getOrder() {
return this.order;
return ORDER;
}
@Override

7
core/spring-boot/src/main/java/org/springframework/boot/convert/ApplicationConversionService.java

@ -379,13 +379,6 @@ public class ApplicationConversionService extends FormattingConversionService { @@ -379,13 +379,6 @@ public class ApplicationConversionService extends FormattingConversionService {
}
}
private static <B, T> void addBean(FormatterRegistry registry, B bean, @Nullable ResolvableType beanType,
Class<T> type, Consumer<B> standardRegistrar,
BiFunction<B, @Nullable ResolvableType, BeanAdapter<?>> beanAdapterFactory) {
addBean(registry, bean, beanType, type, standardRegistrar,
() -> registry.addConverter(beanAdapterFactory.apply(bean, beanType)));
}
private static <B, T> void addBeanWithType(FormatterRegistry registry, B bean, ResolvableType beanType,
Class<T> type, Consumer<B> standardRegistrar,
BiFunction<B, ResolvableType, BeanAdapter<?>> beanAdapterFactory) {

8
core/spring-boot/src/main/java/org/springframework/boot/retry/RetryPolicySettings.java

@ -181,12 +181,12 @@ public final class RetryPolicySettings { @@ -181,12 +181,12 @@ public final class RetryPolicySettings {
/**
* Set the factory to use to create the {@link RetryPolicy}, or {@code null} to use
* the default. The function takes a {@link RetryPolicy.Builder} initialized with the
* state of this instance that can be further configured, or ignored to restart from
* scratch.
* the default. The function takes a {@link Builder RetryPolicy.Builder} initialized
* with the state of this instance that can be further configured, or ignored to
* restart from scratch.
* @param factory a factory to customize the retry policy.
*/
public void setFactory(@Nullable Function<Builder, RetryPolicy> factory) {
public void setFactory(@Nullable Function<RetryPolicy.Builder, RetryPolicy> factory) {
this.factory = factory;
}

10
core/spring-boot/src/main/java/org/springframework/boot/task/SimpleAsyncTaskExecutorBuilder.java

@ -107,11 +107,11 @@ public class SimpleAsyncTaskExecutorBuilder { @@ -107,11 +107,11 @@ public class SimpleAsyncTaskExecutorBuilder {
/**
* Set whether to cancel remaining tasks on close. By default {@code false} not
* tracking active threads at all or just interrupting any remaining threads that
* still have not finished after the specified {@link #taskTerminationTimeout
* taskTerminationTimeout}. Switch this to {@code true} for immediate interruption on
* close, either in combination with a subsequent termination timeout or without any
* waiting at all, depending on whether a {@code taskTerminationTimeout} has been
* specified as well.
* still have not finished after the specified
* {@link #taskTerminationTimeout(Duration) taskTerminationTimeout}. Switch this to
* {@code true} for immediate interruption on close, either in combination with a
* subsequent termination timeout or without any waiting at all, depending on whether
* a {@code taskTerminationTimeout} has been specified as well.
* @param cancelRemainingTasksOnClose whether to cancel remaining tasks on close
* @return a new builder instance
* @since 4.0.0

1
core/spring-boot/src/test/java/org/springframework/boot/context/metrics/buffering/BufferingApplicationStartupTests.java

@ -92,6 +92,7 @@ class BufferingApplicationStartupTests { @@ -92,6 +92,7 @@ class BufferingApplicationStartupTests {
}
@Test
@SuppressWarnings("resource")
void taggingShouldFailWhenEventAlreadyRecorded() {
BufferingApplicationStartup applicationStartup = new BufferingApplicationStartup(2);
StartupStep step = applicationStartup.start("first");

2
documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/messaging/kafka/streams/MyKafkaStreamsConfiguration.java

@ -33,7 +33,7 @@ import org.springframework.kafka.annotation.EnableKafkaStreams; @@ -33,7 +33,7 @@ import org.springframework.kafka.annotation.EnableKafkaStreams;
public class MyKafkaStreamsConfiguration {
@Bean
@SuppressWarnings("removal")
@SuppressWarnings({ "deprecation", "removal" })
public KStream<Integer, String> kStream(StreamsBuilder streamsBuilder) {
KStream<Integer, String> stream = streamsBuilder.stream("ks1In");
stream.map(this::uppercaseValue)

12
module/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/info/InfoPropertiesInfoContributor.java

@ -16,8 +16,10 @@ @@ -16,8 +16,10 @@
package org.springframework.boot.actuate.info;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@ -99,11 +101,13 @@ public abstract class InfoPropertiesInfoContributor<T extends InfoProperties> im @@ -99,11 +101,13 @@ public abstract class InfoPropertiesInfoContributor<T extends InfoProperties> im
}
private Iterable<ConfigurationPropertySource> ensureNonNullContent(
Iterable<@Nullable ConfigurationPropertySource> adapted) {
for (ConfigurationPropertySource source : adapted) {
Assert.state(source != null, "'source' must not be null");
Iterable<@Nullable ConfigurationPropertySource> sources) {
List<ConfigurationPropertySource> nonNullSources = new ArrayList<>(1);
for (ConfigurationPropertySource source : sources) {
Assert.notNull(source, "'source' must not be null");
nonNullSources.add(source);
}
return (Iterable<ConfigurationPropertySource>) adapted;
return nonNullSources;
}
/**

7
module/spring-boot-graphql/src/main/java/org/springframework/boot/graphql/autoconfigure/GraphQlAutoConfiguration.java

@ -32,7 +32,6 @@ import org.jspecify.annotations.Nullable; @@ -32,7 +32,6 @@ import org.jspecify.annotations.Nullable;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.beans.factory.ListableBeanFactory;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.AutoConfiguration;
@ -84,12 +83,6 @@ public final class GraphQlAutoConfiguration { @@ -84,12 +83,6 @@ public final class GraphQlAutoConfiguration {
private static final Log logger = LogFactory.getLog(GraphQlAutoConfiguration.class);
private final ListableBeanFactory beanFactory;
GraphQlAutoConfiguration(ListableBeanFactory beanFactory) {
this.beanFactory = beanFactory;
}
@Bean
@ConditionalOnMissingBean
GraphQlSource graphQlSource(ResourcePatternResolver resourcePatternResolver, GraphQlProperties properties,

5
module/spring-boot-jetty/src/main/java/org/springframework/boot/jetty/JettyHandlerWrappers.java

@ -21,7 +21,6 @@ import org.eclipse.jetty.http.HttpMethod; @@ -21,7 +21,6 @@ import org.eclipse.jetty.http.HttpMethod;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Response;
import org.eclipse.jetty.server.handler.gzip.GzipHandler;
import org.eclipse.jetty.util.Callback;
import org.springframework.boot.web.server.Compression;
@ -36,9 +35,9 @@ final class JettyHandlerWrappers { @@ -36,9 +35,9 @@ final class JettyHandlerWrappers {
private JettyHandlerWrappers() {
}
@SuppressWarnings("removal")
@SuppressWarnings({ "deprecation", "removal" })
static Handler.Wrapper createGzipHandlerWrapper(Compression compression) {
GzipHandler handler = new GzipHandler();
org.eclipse.jetty.server.handler.gzip.GzipHandler handler = new org.eclipse.jetty.server.handler.gzip.GzipHandler();
handler.setMinGzipSize((int) compression.getMinResponseSize().toBytes());
handler.setIncludedMimeTypes(compression.getMimeTypes());
for (HttpMethod httpMethod : HttpMethod.values()) {

4
smoke-test/spring-boot-smoke-test-web-secure-jdbc/src/main/java/smoketest/web/secure/jdbc/SampleWebSecureJdbcApplication.java

@ -60,9 +60,7 @@ public class SampleWebSecureJdbcApplication implements WebMvcConfigurer { @@ -60,9 +60,7 @@ public class SampleWebSecureJdbcApplication implements WebMvcConfigurer {
@Bean
public JdbcUserDetailsManager jdbcUserDetailsManager(DataSource dataSource) {
JdbcUserDetailsManager jdbcUserDetailsManager = new JdbcUserDetailsManager();
jdbcUserDetailsManager.setDataSource(dataSource);
return jdbcUserDetailsManager;
return new JdbcUserDetailsManager(dataSource);
}
}

Loading…
Cancel
Save