From f22bdf4734da31c09a3f3e369ddca2f968d32de8 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Fri, 19 Jan 2024 17:29:16 +0100 Subject: [PATCH] Polishing --- .../org/springframework/context/SmartLifecycle.java | 4 ++-- .../transaction/reactive/TransactionContext.java | 11 +++++++---- .../http/server/reactive/ChannelSendOperator.java | 4 ++-- .../web/servlet/handler/AbstractHandlerMapping.java | 7 ++++--- .../servlet/handler/AbstractHandlerMethodMapping.java | 5 +++-- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/spring-context/src/main/java/org/springframework/context/SmartLifecycle.java b/spring-context/src/main/java/org/springframework/context/SmartLifecycle.java index 06f98a4048c..5ad500d1b21 100644 --- a/spring-context/src/main/java/org/springframework/context/SmartLifecycle.java +++ b/spring-context/src/main/java/org/springframework/context/SmartLifecycle.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-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. @@ -121,7 +121,7 @@ public interface SmartLifecycle extends Lifecycle, Phased { /** * Return the phase that this lifecycle object is supposed to run in. *

The default implementation returns {@link #DEFAULT_PHASE} in order to - * let {@code stop()} callbacks execute after regular {@code Lifecycle} + * let {@code stop()} callbacks execute before regular {@code Lifecycle} * implementations. * @see #isAutoStartup() * @see #start() diff --git a/spring-tx/src/main/java/org/springframework/transaction/reactive/TransactionContext.java b/spring-tx/src/main/java/org/springframework/transaction/reactive/TransactionContext.java index 280669b83f0..930fb09bf30 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/reactive/TransactionContext.java +++ b/spring-tx/src/main/java/org/springframework/transaction/reactive/TransactionContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2021 the original author or authors. + * Copyright 2002-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. @@ -39,7 +39,8 @@ import org.springframework.util.function.SingletonSupplier; */ public class TransactionContext { - private final @Nullable TransactionContext parent; + @Nullable + private final TransactionContext parent; private final SingletonSupplier contextId = SingletonSupplier.of(UUID::randomUUID); @@ -48,11 +49,13 @@ public class TransactionContext { @Nullable private Set synchronizations; - private volatile @Nullable String currentTransactionName; + @Nullable + private volatile String currentTransactionName; private volatile boolean currentTransactionReadOnly; - private volatile @Nullable Integer currentTransactionIsolationLevel; + @Nullable + private volatile Integer currentTransactionIsolationLevel; private volatile boolean actualTransactionActive; diff --git a/spring-web/src/main/java/org/springframework/http/server/reactive/ChannelSendOperator.java b/spring-web/src/main/java/org/springframework/http/server/reactive/ChannelSendOperator.java index 6b5e4095955..8a757f92a19 100644 --- a/spring-web/src/main/java/org/springframework/http/server/reactive/ChannelSendOperator.java +++ b/spring-web/src/main/java/org/springframework/http/server/reactive/ChannelSendOperator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-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. @@ -39,7 +39,7 @@ import org.springframework.util.Assert; * to defer the invocation of the write function, until we know if the source * publisher will begin publishing without an error. If the first emission is * an error, the write function is bypassed, and the error is sent directly - * through the result publisher. Otherwise the write function is invoked. + * through the result publisher. Otherwise, the write function is invoked. * * @author Rossen Stoyanchev * @author Stephane Maldini diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMapping.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMapping.java index 2f416b6c5ce..8b4fdd7aa79 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMapping.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMapping.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2021 the original author or authors. + * Copyright 2002-2023 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. @@ -157,13 +157,14 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport * @param patternParser the parser to use * @since 5.3 */ - public void setPatternParser(PathPatternParser patternParser) { + public void setPatternParser(@Nullable PathPatternParser patternParser) { this.patternParser = patternParser; } /** * Return the {@link #setPatternParser(PathPatternParser) configured} - * {@code PathPatternParser}, or {@code null}. + * {@code PathPatternParser}, or {@code null} otherwise which indicates that + * String pattern matching with {@link AntPathMatcher} is enabled instead. * @since 5.3 */ @Nullable diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMethodMapping.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMethodMapping.java index 46b1d36f44b..5df50148fa7 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMethodMapping.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMethodMapping.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2021 the original author or authors. + * Copyright 2002-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. @@ -102,7 +102,7 @@ public abstract class AbstractHandlerMethodMapping extends AbstractHandlerMap @Override - public void setPatternParser(PathPatternParser patternParser) { + public void setPatternParser(@Nullable PathPatternParser patternParser) { Assert.state(this.mappingRegistry.getRegistrations().isEmpty(), "PathPatternParser must be set before the initialization of " + "request mappings through InitializingBean#afterPropertiesSet."); @@ -567,6 +567,7 @@ public abstract class AbstractHandlerMethodMapping extends AbstractHandlerMap /** * A registry that maintains all mappings to handler methods, exposing methods * to perform lookups and providing concurrent access. + * *

Package-private for testing purposes. */ class MappingRegistry {