File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed
src/main/java/org/springframework/data/r2dbc/dialect Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change 2525
2626import org .springframework .core .io .support .SpringFactoriesLoader ;
2727import org .springframework .dao .NonTransientDataAccessException ;
28+ import org .springframework .data .util .Optionals ;
2829import org .springframework .util .LinkedCaseInsensitiveMap ;
2930
3031/**
@@ -55,9 +56,8 @@ public static R2dbcDialect getDialect(ConnectionFactory connectionFactory) {
5556
5657 return DETECTORS .stream () //
5758 .map (it -> it .getDialect (connectionFactory )) //
58- .filter ( Optional :: isPresent ) //
59+ .flatMap ( Optionals :: toStream ) //
5960 .findFirst () //
60- .flatMap (it -> it ) //
6161 .orElseThrow (() -> {
6262 return new NoDialectException (
6363 String .format ("Cannot determine a dialect for %s using %s. Please provide a Dialect." ,
@@ -127,13 +127,10 @@ public Optional<R2dbcDialect> getDialect(ConnectionFactory connectionFactory) {
127127 return Optional .of (r2dbcDialect );
128128 }
129129
130- for (String key : BUILTIN .keySet ()) {
131- if (metadata .getName ().contains (key )) {
132- return Optional .of (BUILTIN .get (key ));
133- }
134- }
135-
136- return Optional .empty ();
130+ return BUILTIN .keySet ().stream () //
131+ .filter (it -> metadata .getName ().contains (it )) //
132+ .map (BUILTIN ::get ) //
133+ .findFirst ();
137134 }
138135 }
139136}
You can’t perform that action at this time.
0 commit comments