36
36
import org .neo4j .driver .SessionConfig ;
37
37
import org .neo4j .driver .internal .DriverFactory ;
38
38
import org .neo4j .driver .internal .SecuritySettings ;
39
+ import org .neo4j .driver .internal .security .SecurityPlan ;
39
40
import org .neo4j .driver .internal .security .SecurityPlans ;
40
41
import org .springframework .core .log .LogMessage ;
41
42
import org .springframework .lang .Nullable ;
@@ -174,12 +175,14 @@ public static final class Neo4jConnectionSupport implements ExtensionContext.Sto
174
175
175
176
private final DriverFactory driverFactory ;
176
177
177
- public final String url ;
178
+ public final URI uri ;
178
179
179
180
public final AuthToken authToken ;
180
181
181
182
public final Config config ;
182
183
184
+ private final SecurityPlan securityPlan ;
185
+
183
186
private volatile ServerVersion cachedServerVersion ;
184
187
185
188
/**
@@ -188,11 +191,13 @@ public static final class Neo4jConnectionSupport implements ExtensionContext.Sto
188
191
private volatile Driver driverInstance ;
189
192
190
193
public Neo4jConnectionSupport (String url , AuthToken authToken ) {
191
- this .url = url ;
194
+ this .uri = URI . create ( url ) ;
192
195
this .authToken = authToken ;
193
196
this .config = Config .builder ().withLogging (Logging .slf4j ())
194
197
.withMaxConnectionPoolSize (Runtime .getRuntime ().availableProcessors ())
195
198
.build ();
199
+ var settings = new SecuritySettings (config .encrypted (), config .trustStrategy ());
200
+ this .securityPlan = SecurityPlans .createSecurityPlan (settings , uri .getScheme ());
196
201
this .driverFactory = new DriverFactory ();
197
202
}
198
203
@@ -219,9 +224,6 @@ public Driver getDriver() {
219
224
}
220
225
221
226
private Driver createDriverInstance () {
222
- var uri = URI .create (url );
223
- var settings = new SecuritySettings (config .encrypted (), config .trustStrategy ());
224
- var securityPlan = SecurityPlans .createSecurityPlan (settings , uri .getScheme ());
225
227
return this .driverFactory .newInstance (uri , AuthTokenManagers .basic (() -> authToken ), config , securityPlan , EVENT_LOOP_GROUP , null );
226
228
}
227
229
0 commit comments