Skip to content

Commit 333249e

Browse files
committed
Polishing
1 parent 2573ba4 commit 333249e

File tree

3 files changed

+23
-39
lines changed

3 files changed

+23
-39
lines changed

framework-docs/modules/ROOT/pages/data-access/jdbc/core.adoc

+11-21
Original file line numberDiff line numberDiff line change
@@ -501,8 +501,8 @@ extend from it, your sub-class inherits a `setDataSource(..)` method from the
501501
Regardless of which of the above template initialization styles you choose to use (or
502502
not), it is seldom necessary to create a new instance of a `JdbcTemplate` class each
503503
time you want to run SQL. Once configured, a `JdbcTemplate` instance is thread-safe.
504-
If your application accesses multiple
505-
databases, you may want multiple `JdbcTemplate` instances, which requires multiple `DataSources` and, subsequently, multiple differently
504+
If your application accesses multiple databases, you may want multiple `JdbcTemplate`
505+
instances, which requires multiple `DataSources` and, subsequently, multiple differently
506506
configured `JdbcTemplate` instances.
507507

508508

@@ -531,11 +531,8 @@ Java::
531531
}
532532
533533
public int countOfActorsByFirstName(String firstName) {
534-
535-
String sql = "select count(*) from T_ACTOR where first_name = :first_name";
536-
534+
String sql = "select count(*) from t_actor where first_name = :first_name";
537535
SqlParameterSource namedParameters = new MapSqlParameterSource("first_name", firstName);
538-
539536
return this.namedParameterJdbcTemplate.queryForObject(sql, namedParameters, Integer.class);
540537
}
541538
----
@@ -547,7 +544,7 @@ Kotlin::
547544
private val namedParameterJdbcTemplate = NamedParameterJdbcTemplate(dataSource)
548545
549546
fun countOfActorsByFirstName(firstName: String): Int {
550-
val sql = "select count(*) from T_ACTOR where first_name = :first_name"
547+
val sql = "select count(*) from t_actor where first_name = :first_name"
551548
val namedParameters = MapSqlParameterSource("first_name", firstName)
552549
return namedParameterJdbcTemplate.queryForObject(sql, namedParameters, Int::class.java)!!
553550
}
@@ -579,12 +576,9 @@ Java::
579576
}
580577
581578
public int countOfActorsByFirstName(String firstName) {
582-
583-
String sql = "select count(*) from T_ACTOR where first_name = :first_name";
584-
579+
String sql = "select count(*) from t_actor where first_name = :first_name";
585580
Map<String, String> namedParameters = Collections.singletonMap("first_name", firstName);
586-
587-
return this.namedParameterJdbcTemplate.queryForObject(sql, namedParameters, Integer.class);
581+
return this.namedParameterJdbcTemplate.queryForObject(sql, namedParameters, Integer.class);
588582
}
589583
----
590584
@@ -596,7 +590,7 @@ Kotlin::
596590
private val namedParameterJdbcTemplate = NamedParameterJdbcTemplate(dataSource)
597591
598592
fun countOfActorsByFirstName(firstName: String): Int {
599-
val sql = "select count(*) from T_ACTOR where first_name = :first_name"
593+
val sql = "select count(*) from t_actor where first_name = :first_name"
600594
val namedParameters = mapOf("first_name" to firstName)
601595
return namedParameterJdbcTemplate.queryForObject(sql, namedParameters, Int::class.java)!!
602596
}
@@ -644,7 +638,6 @@ Java::
644638
}
645639
646640
// setters omitted...
647-
648641
}
649642
----
650643
@@ -673,12 +666,9 @@ Java::
673666
}
674667
675668
public int countOfActors(Actor exampleActor) {
676-
677669
// notice how the named parameters match the properties of the above 'Actor' class
678-
String sql = "select count(*) from T_ACTOR where first_name = :firstName and last_name = :lastName";
679-
670+
String sql = "select count(*) from t_actor where first_name = :firstName and last_name = :lastName";
680671
SqlParameterSource namedParameters = new BeanPropertySqlParameterSource(exampleActor);
681-
682672
return this.namedParameterJdbcTemplate.queryForObject(sql, namedParameters, Integer.class);
683673
}
684674
----
@@ -694,7 +684,7 @@ Kotlin::
694684
695685
fun countOfActors(exampleActor: Actor): Int {
696686
// notice how the named parameters match the properties of the above 'Actor' class
697-
val sql = "select count(*) from T_ACTOR where first_name = :firstName and last_name = :lastName"
687+
val sql = "select count(*) from t_actor where first_name = :firstName and last_name = :lastName"
698688
val namedParameters = BeanPropertySqlParameterSource(exampleActor)
699689
return namedParameterJdbcTemplate.queryForObject(sql, namedParameters, Int::class.java)!!
700690
}
@@ -707,8 +697,8 @@ functionality that is present only in the `JdbcTemplate` class, you can use the
707697
`getJdbcOperations()` method to access the wrapped `JdbcTemplate` through the
708698
`JdbcOperations` interface.
709699

710-
See also xref:data-access/jdbc/core.adoc#jdbc-JdbcTemplate-idioms[`JdbcTemplate` Best Practices] for guidelines on using the
711-
`NamedParameterJdbcTemplate` class in the context of an application.
700+
See also xref:data-access/jdbc/core.adoc#jdbc-JdbcTemplate-idioms[`JdbcTemplate` Best Practices]
701+
for guidelines on using the `NamedParameterJdbcTemplate` class in the context of an application.
712702

713703

714704
[[jdbc-SQLExceptionTranslator]]

framework-docs/modules/ROOT/pages/integration/cache/annotations.adoc

+11-16
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ through its `key` attribute. You can use xref:core/expressions.adoc[SpEL] to pic
9898
arguments of interest (or their nested properties), perform operations, or even
9999
invoke arbitrary methods without having to write any code or implement any interface.
100100
This is the recommended approach over the
101-
xref:integration/cache/annotations.adoc#cache-annotations-cacheable-default-key[default generator], since methods tend to be
102-
quite different in signatures as the code base grows. While the default strategy might
103-
work for some methods, it rarely works for all methods.
101+
xref:integration/cache/annotations.adoc#cache-annotations-cacheable-default-key[default generator],
102+
since methods tend to be quite different in signatures as the code base grows. While the
103+
default strategy might work for some methods, it rarely works for all methods.
104104

105105
The following examples use various SpEL declarations (if you are not familiar with SpEL,
106106
do yourself a favor and read xref:core/expressions.adoc[Spring Expression Language]):
@@ -137,9 +137,8 @@ that specifies both results in an exception.
137137
[[cache-annotations-cacheable-default-cache-resolver]]
138138
=== Default Cache Resolution
139139

140-
The caching abstraction uses a simple `CacheResolver` that
141-
retrieves the caches defined at the operation level by using the configured
142-
`CacheManager`.
140+
The caching abstraction uses a simple `CacheResolver` that retrieves the caches
141+
defined at the operation level by using the configured `CacheManager`.
143142

144143
To provide a different default cache resolver, you need to implement the
145144
`org.springframework.cache.interceptor.CacheResolver` interface.
@@ -160,12 +159,11 @@ For applications that work with several cache managers, you can set the
160159
----
161160
<1> Specifying `anotherCacheManager`.
162161

163-
164162
You can also replace the `CacheResolver` entirely in a fashion similar to that of
165-
replacing xref:integration/cache/annotations.adoc#cache-annotations-cacheable-key[key generation]. The resolution is
166-
requested for every cache operation, letting the implementation actually resolve
167-
the caches to use based on runtime arguments. The following example shows how to
168-
specify a `CacheResolver`:
163+
replacing xref:integration/cache/annotations.adoc#cache-annotations-cacheable-key[key generation].
164+
The resolution is requested for every cache operation, letting the implementation
165+
actually resolve the caches to use based on runtime arguments. The following example
166+
shows how to specify a `CacheResolver`:
169167

170168
[source,java,indent=0,subs="verbatim,quotes"]
171169
----
@@ -174,7 +172,6 @@ specify a `CacheResolver`:
174172
----
175173
<1> Specifying the `CacheResolver`.
176174

177-
178175
[NOTE]
179176
====
180177
Since Spring 4.1, the `value` attribute of the cache annotations are no longer
@@ -229,7 +226,6 @@ argument `name` has a length shorter than 32:
229226
----
230227
<1> Setting a condition on `@Cacheable`.
231228

232-
233229
In addition to the `condition` parameter, you can use the `unless` parameter to veto the
234230
adding of a value to the cache. Unlike `condition`, `unless` expressions are evaluated
235231
after the method has been invoked. To expand on the previous example, perhaps we only
@@ -242,7 +238,6 @@ want to cache paperback books, as the following example does:
242238
----
243239
<1> Using the `unless` attribute to block hardbacks.
244240

245-
246241
The cache abstraction supports `java.util.Optional` return types. If an `Optional` value
247242
is _present_, it will be stored in the associated cache. If an `Optional` value is not
248243
present, `null` will be stored in the associated cache. `#result` always refers to the
@@ -344,7 +339,7 @@ confirm the exclusion.
344339

345340

346341
[[cache-annotations-evict]]
347-
== The `@CacheEvict` annotation
342+
== The `@CacheEvict` Annotation
348343

349344
The cache abstraction allows not just population of a cache store but also eviction.
350345
This process is useful for removing stale or unused data from the cache. As opposed to
@@ -402,7 +397,7 @@ The following example uses two `@CacheEvict` annotations:
402397

403398

404399
[[cache-annotations-config]]
405-
== The `@CacheConfig` annotation
400+
== The `@CacheConfig` Annotation
406401

407402
So far, we have seen that caching operations offer many customization options and that
408403
you can set these options for each operation. However, some of the customization options

spring-r2dbc/src/main/java/org/springframework/r2dbc/core/DefaultDatabaseClient.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,7 @@ private Mono<Connection> getConnection() {
163163
/**
164164
* Release the {@link Connection}.
165165
* @param connection to close.
166-
* @return a {@link Publisher} that completes successfully when the connection is
167-
* closed
166+
* @return a {@link Publisher} that completes successfully when the connection is closed
168167
*/
169168
private Publisher<Void> closeConnection(Connection connection) {
170169
return ConnectionFactoryUtils.currentConnectionFactory(

0 commit comments

Comments
 (0)