From 746b1b2fe16bec5d089e092c5eaf9db617bf4566 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Sun, 23 May 2021 18:27:31 +0200 Subject: [PATCH] Polishing --- .../simp/stomp/StompClientSupport.java | 4 +- .../connection/R2dbcTransactionManager.java | 48 +++++++-------- .../connection/SingleConnectionFactory.java | 60 ++++++++++--------- .../web/bind/annotation/CrossOrigin.java | 4 +- .../view/groovy/GroovyMarkupViewResolver.java | 8 +-- 5 files changed, 64 insertions(+), 60 deletions(-) diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompClientSupport.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompClientSupport.java index 7da45122b58..03df60b7467 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompClientSupport.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompClientSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2021 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. @@ -30,7 +30,7 @@ import org.springframework.util.Assert; * *

Subclasses can connect over WebSocket or TCP using any library. When creating * a new connection, a subclass can create an instance of {@link DefaultStompSession} - * which extends {@link org.springframework.messaging.tcp.TcpConnectionHandler} + * which implements {@link org.springframework.messaging.tcp.TcpConnectionHandler} * whose lifecycle methods the subclass must then invoke. * *

In effect, {@code TcpConnectionHandler} and {@code TcpConnection} are the diff --git a/spring-r2dbc/src/main/java/org/springframework/r2dbc/connection/R2dbcTransactionManager.java b/spring-r2dbc/src/main/java/org/springframework/r2dbc/connection/R2dbcTransactionManager.java index 88ac9292126..e22c7a1dac9 100644 --- a/spring-r2dbc/src/main/java/org/springframework/r2dbc/connection/R2dbcTransactionManager.java +++ b/spring-r2dbc/src/main/java/org/springframework/r2dbc/connection/R2dbcTransactionManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2021 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,18 +39,18 @@ import org.springframework.util.Assert; * {@link org.springframework.transaction.ReactiveTransactionManager} * implementation for a single R2DBC {@link ConnectionFactory}. This class is * capable of working in any environment with any R2DBC driver, as long as the - * setup uses a {@link ConnectionFactory} as its {@link Connection} factory - * mechanism. Binds a R2DBC {@link Connection} from the specified - * {@link ConnectionFactory} to the current subscriber context, potentially - * allowing for one context-bound {@link Connection} per {@link ConnectionFactory}. + * setup uses a {@code ConnectionFactory} as its {@link Connection} factory + * mechanism. Binds a R2DBC {@code Connection} from the specified + * {@code ConnectionFactory} to the current subscriber context, potentially + * allowing for one context-bound {@code Connection} per {@code ConnectionFactory}. * - *

Note: The {@link ConnectionFactory} that this transaction manager - * operates on needs to return independent {@link Connection}s. - * The {@link Connection}s may come from a pool (the typical case), but the - * {@link ConnectionFactory} must not return scoped scoped {@link Connection}s - * or the like. This transaction manager will associate {@link Connection} + *

Note: The {@code ConnectionFactory} that this transaction manager + * operates on needs to return independent {@code Connection}s. + * The {@code Connection}s may come from a pool (the typical case), but the + * {@code ConnectionFactory} must not return scoped scoped {@code Connection}s + * or the like. This transaction manager will associate {@code Connection} * with context-bound transactions itself, according to the specified propagation - * behavior. It assumes that a separate, independent {@link Connection} can + * behavior. It assumes that a separate, independent {@code Connection} can * be obtained even during an ongoing transaction. * *

Application code is required to retrieve the R2DBC Connection via @@ -59,18 +59,18 @@ import org.springframework.util.Assert; * Spring classes such as {@code DatabaseClient} use this strategy implicitly. * If not used in combination with this transaction manager, the * {@link ConnectionFactoryUtils} lookup strategy behaves exactly like the - * native {@link ConnectionFactory} lookup; it can thus be used in a portable fashion. + * native {@code ConnectionFactory} lookup; it can thus be used in a portable fashion. * *

Alternatively, you can allow application code to work with the standard * R2DBC lookup pattern {@link ConnectionFactory#create()}, for example for code * that is not aware of Spring at all. In that case, define a - * {@link TransactionAwareConnectionFactoryProxy} for your target {@link ConnectionFactory}, - * and pass that proxy {@link ConnectionFactory} to your DAOs, which will automatically + * {@link TransactionAwareConnectionFactoryProxy} for your target {@code ConnectionFactory}, + * and pass that proxy {@code ConnectionFactory} to your DAOs, which will automatically * participate in Spring-managed transactions when accessing it. * *

This transaction manager triggers flush callbacks on registered transaction * synchronizations (if synchronization is generally active), assuming resources - * operating on the underlying R2DBC {@link Connection}. + * operating on the underlying R2DBC {@code Connection}. * * @author Mark Paluch * @since 5.3 @@ -88,14 +88,14 @@ public class R2dbcTransactionManager extends AbstractReactiveTransactionManager /** - * Create a new {@link R2dbcTransactionManager} instance. + * Create a new {@code R2dbcTransactionManager} instance. * A ConnectionFactory has to be set to be able to use it. * @see #setConnectionFactory */ public R2dbcTransactionManager() {} /** - * Create a new {@link R2dbcTransactionManager} instance. + * Create a new {@code R2dbcTransactionManager} instance. * @param connectionFactory the R2DBC ConnectionFactory to manage transactions for */ public R2dbcTransactionManager(ConnectionFactory connectionFactory) { @@ -107,10 +107,10 @@ public class R2dbcTransactionManager extends AbstractReactiveTransactionManager /** * Set the R2DBC {@link ConnectionFactory} that this instance should manage transactions for. - *

This will typically be a locally defined {@link ConnectionFactory}, for example an connection pool. - *

The {@link ConnectionFactory} passed in here needs to return independent {@link Connection}s. - * The {@link Connection}s may come from a pool (the typical case), but the {@link ConnectionFactory} - * must not return scoped {@link Connection}s or the like. + *

This will typically be a locally defined {@code ConnectionFactory}, for example an connection pool. + *

The {@code ConnectionFactory} passed in here needs to return independent {@link Connection}s. + * The {@code Connection}s may come from a pool (the typical case), but the {@code ConnectionFactory} + * must not return scoped {@code Connection}s or the like. * @see TransactionAwareConnectionFactoryProxy */ public void setConnectionFactory(@Nullable ConnectionFactory connectionFactory) { @@ -127,7 +127,7 @@ public class R2dbcTransactionManager extends AbstractReactiveTransactionManager /** * Obtain the {@link ConnectionFactory} for actual use. - * @return the {@link ConnectionFactory} (never {@code null}) + * @return the {@code ConnectionFactory} (never {@code null}) * @throws IllegalStateException in case of no ConnectionFactory set */ protected ConnectionFactory obtainConnectionFactory() { @@ -405,9 +405,9 @@ public class R2dbcTransactionManager extends AbstractReactiveTransactionManager } /** - * Resolve the {@link TransactionDefinition#getIsolationLevel() isolation level constant} to a R2DBC + * Resolve the {@linkplain TransactionDefinition#getIsolationLevel() isolation level constant} to a R2DBC * {@link IsolationLevel}. If you'd like to extend isolation level translation for vendor-specific - * {@link IsolationLevel}s, override this method accordingly. + * {@code IsolationLevel}s, override this method accordingly. * @param isolationLevel the isolation level to translate. * @return the resolved isolation level. Can be {@code null} if not resolvable or the isolation level * should remain {@link TransactionDefinition#ISOLATION_DEFAULT default}. diff --git a/spring-r2dbc/src/main/java/org/springframework/r2dbc/connection/SingleConnectionFactory.java b/spring-r2dbc/src/main/java/org/springframework/r2dbc/connection/SingleConnectionFactory.java index c90d03c1ccd..f40d34ea99b 100644 --- a/spring-r2dbc/src/main/java/org/springframework/r2dbc/connection/SingleConnectionFactory.java +++ b/spring-r2dbc/src/main/java/org/springframework/r2dbc/connection/SingleConnectionFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2021 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. @@ -36,25 +36,25 @@ import org.springframework.util.Assert; /** * Implementation of {@link DelegatingConnectionFactory} that wraps a - * single R2DBC Connection which is not closed after use. + * single R2DBC {@link Connection} which is not closed after use. * Obviously, this is not multi-threading capable. * *

Note that at shutdown, someone should close the underlying - * Connection via the {@code close()} method. Client code will - * never call close on the Connection handle if it is + * {@code Connection} via the {@code close()} method. Client code will + * never call close on the {@code Connection} handle if it is * SmartConnectionFactory-aware (e.g. uses * {@link ConnectionFactoryUtils#releaseConnection(Connection, ConnectionFactory)}). * *

If client code will call {@link Connection#close()} in the - * assumption of a pooled Connection, like when using persistence tools, - * set "suppressClose" to "true". This will return a close-suppressing + * assumption of a pooled {@code Connection}, like when using persistence tools, + * set "suppressClose" to {@code true}. This will return a close-suppressing * proxy instead of the physical Connection. * *

This is primarily intended for testing and pipelining usage of connections. - * For example, it enables easy testing outside an application server, for code + * For example, it enables easy testing outside an application server for code * that expects to work on a {@link ConnectionFactory}. * Note that this implementation does not act as a connection pool-like utility. - * Connection pooling requires a {@link ConnectionFactory} implemented by e.g. + * Connection pooling requires a pooling {@link ConnectionFactory} such as one from * {@code r2dbc-pool}. * * @author Mark Paluch @@ -90,10 +90,10 @@ public class SingleConnectionFactory extends DelegatingConnectionFactory } /** - * Create a new {@link SingleConnectionFactory} using a R2DBC connection URL. - * @param url the R2DBC URL to use for accessing {@link ConnectionFactory} discovery. - * @param suppressClose if the returned {@link Connection} should be a close-suppressing proxy - * or the physical {@link Connection}. + * Create a new {@code SingleConnectionFactory} using an R2DBC connection URL. + * @param url the R2DBC URL to use for accessing {@link ConnectionFactory} discovery + * @param suppressClose if the returned {@link Connection} should be a + * close-suppressing proxy or the physical {@code Connection} * @see ConnectionFactories#get(String) */ public SingleConnectionFactory(String url, boolean suppressClose) { @@ -103,13 +103,15 @@ public class SingleConnectionFactory extends DelegatingConnectionFactory } /** - * Create a new {@link SingleConnectionFactory} with a given {@link Connection} and - * {@link ConnectionFactoryMetadata}. - * @param target underlying target {@link Connection}. - * @param metadata {@link ConnectionFactory} metadata to be associated with this {@link ConnectionFactory}. - * @param suppressClose if the {@link Connection} should be wrapped with a {@link Connection} that suppresses - * {@code close()} calls (to allow for normal {@code close()} usage in applications that expect a pooled - * {@link Connection}). + * Create a new {@code SingleConnectionFactory} with a given {@link Connection} + * and {@link ConnectionFactoryMetadata}. + * @param target underlying target {@code Connection} + * @param metadata {@code ConnectionFactory} metadata to be associated with + * this {@code ConnectionFactory} + * @param suppressClose {@code true} if the {@code Connection} should be wrapped + * with a {@code Connection} that suppresses {@code close()} calls (to allow + * for normal {@code close()} usage in applications that expect a pooled + * {@code Connection}) */ public SingleConnectionFactory(Connection target, ConnectionFactoryMetadata metadata, boolean suppressClose) { super(new ConnectionFactory() { @@ -133,7 +135,7 @@ public class SingleConnectionFactory extends DelegatingConnectionFactory /** * Set whether the returned {@link Connection} should be a close-suppressing proxy - * or the physical {@link Connection}. + * or the physical {@code Connection}. */ public void setSuppressClose(boolean suppressClose) { this.suppressClose = suppressClose; @@ -141,21 +143,23 @@ public class SingleConnectionFactory extends DelegatingConnectionFactory /** * Return whether the returned {@link Connection} will be a close-suppressing proxy - * or the physical {@link Connection}. + * or the physical {@code Connection}. */ protected boolean isSuppressClose() { return this.suppressClose; } /** - * Set whether the returned {@link Connection}'s "autoCommit" setting should be overridden. + * Set whether the returned {@link Connection}'s "autoCommit" setting should + * be overridden. */ public void setAutoCommit(boolean autoCommit) { this.autoCommit = autoCommit; } /** - * Return whether the returned {@link Connection}'s "autoCommit" setting should be overridden. + * Return whether the returned {@link Connection}'s "autoCommit" setting should + * be overridden. * @return the "autoCommit" value, or {@code null} if none to be applied */ @Nullable @@ -207,9 +211,9 @@ public class SingleConnectionFactory extends DelegatingConnectionFactory /** * Prepare the {@link Connection} before using it. - * Applies {@link #getAutoCommitValue() auto-commit} settings if configured. - * @param connection the requested {@link Connection}. - * @return the prepared {@link Connection}. + * Applies {@linkplain #getAutoCommitValue() auto-commit} settings if configured. + * @param connection the requested {@code Connection} + * @return the prepared {@code Connection} */ protected Mono prepareConnection(Connection connection) { Boolean autoCommit = getAutoCommitValue(); @@ -222,8 +226,8 @@ public class SingleConnectionFactory extends DelegatingConnectionFactory /** * Wrap the given {@link Connection} with a proxy that delegates every method call to it * but suppresses close calls. - * @param target the original {@link Connection} to wrap. - * @return the wrapped Connection. + * @param target the original {@code Connection} to wrap + * @return the wrapped Connection */ protected Connection getCloseSuppressingConnectionProxy(Connection target) { return (Connection) Proxy.newProxyInstance(SingleConnectionFactory.class.getClassLoader(), diff --git a/spring-web/src/main/java/org/springframework/web/bind/annotation/CrossOrigin.java b/spring-web/src/main/java/org/springframework/web/bind/annotation/CrossOrigin.java index 3d90f384540..0a568d25db2 100644 --- a/spring-web/src/main/java/org/springframework/web/bind/annotation/CrossOrigin.java +++ b/spring-web/src/main/java/org/springframework/web/bind/annotation/CrossOrigin.java @@ -80,14 +80,14 @@ public @interface CrossOrigin { /** * A list of origins for which cross-origin requests are allowed. Please, * see {@link CorsConfiguration#setAllowedOrigins(List)} for details. - *

By default all origins are allowed unless {@code originPatterns} is + *

By default all origins are allowed unless {@link #originPatterns} is * also set in which case {@code originPatterns} is used instead. */ @AliasFor("value") String[] origins() default {}; /** - * Alternative to {@link #origins()} that supports more flexible origins + * Alternative to {@link #origins} that supports more flexible origin * patterns. Please, see {@link CorsConfiguration#setAllowedOriginPatterns(List)} * for details. *

By default this is not set. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/groovy/GroovyMarkupViewResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/groovy/GroovyMarkupViewResolver.java index 06f3d6975ee..97f139e81d0 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/groovy/GroovyMarkupViewResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/groovy/GroovyMarkupViewResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2021 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. @@ -27,11 +27,11 @@ import org.springframework.web.servlet.view.AbstractUrlBasedView; * custom subclasses of it. * *

The view class for all views created by this resolver can be specified - * via the {@link #setViewClass(Class)} property. + * via {@link #setViewClass(Class)}. * *

Note: When chaining ViewResolvers this resolver will check for the * existence of the specified template resources and only return a non-null - * View object if a template is actually found. + * {@code View} object if a template is actually found. * * @author Brian Clozel * @since 4.1 @@ -48,7 +48,7 @@ public class GroovyMarkupViewResolver extends AbstractTemplateViewResolver { } /** - * A convenience constructor that allows for specifying {@link #setPrefix prefix} + * A convenience constructor that allows for specifying the {@link #setPrefix prefix} * and {@link #setSuffix suffix} as constructor arguments. * @param prefix the prefix that gets prepended to view names when building a URL * @param suffix the suffix that gets appended to view names when building a URL