vertx-test\src\main\java\myverticle\JDBCClientFactory.java
1 | |
package myverticle; |
| |
| |
import io.vertx.core.Vertx;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.jdbc.JDBCClient;
import ...
|
| |
7 | |
public class JDBCClientFactory { |
| |
9 | |
private Vertx vertx; |
10 | |
private JsonObject config; |
| |
12 | |
public JDBCClientFactory(Vertx vertx, JsonObject config) { |
13 | 1 |
super(); |
14 | 1 |
this.vertx = vertx; |
15 | 1 |
this.config = config; |
16 | 1 |
} |
| |
18 | |
public JDBCClient createJDBCClient() { |
19 | 1 |
JsonObject jdbcClientConfig = new JsonObject(); |
20 | 1 |
jdbcClientConfig.put(ConfigKeys.DB_URL, config.getBinary(ConfigKeys.DB_URL)); |
21 | 1 |
jdbcClientConfig.put(ConfigKeys.DRIVER_CLASS, config.getBinary(ConfigKeys.DRIVER_CLASS)); |
22 | 1 |
return JDBCClient.createNonShared(vertx, jdbcClientConfig); |
23 | |
} |
| |
25 | |
} |