Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Example for creating a DataSource via CDI
* Please note for this to work you need to add the corresponding dependencies.
* In this case, we use as connection pool
* and an embedded derby database.
public DataSource exposeDataSource() {
Properties props = new Properties();
props.setProperty("dataSource.databaseName", "mydb");
props.put("dataSource.logWriter", new PrintWriter(System.out));
HikariConfig config = new HikariConfig(props);
return new HikariDataSource(config);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.