{"id":23095087,"url":"https://github.com/microbean/microbean-datasource-cdi-hikaricp","last_synced_at":"2025-04-03T19:26:13.530Z","repository":{"id":57739584,"uuid":"143456166","full_name":"microbean/microbean-datasource-cdi-hikaricp","owner":"microbean","description":"microBean Hikari Connection Pool CDI integration","archived":false,"fork":false,"pushed_at":"2018-12-18T01:00:39.000Z","size":866,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-21T17:04:01.230Z","etag":null,"topics":["cdi","hikari-connection-pool","hikari-datasource","hikaricp"],"latest_commit_sha":null,"homepage":"https://microbean.github.io/microbean-datasource-cdi-hikaricp/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/microbean.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-03T17:38:07.000Z","updated_at":"2018-12-18T00:54:44.000Z","dependencies_parsed_at":"2022-08-24T17:50:37.720Z","dependency_job_id":null,"html_url":"https://github.com/microbean/microbean-datasource-cdi-hikaricp","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microbean%2Fmicrobean-datasource-cdi-hikaricp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microbean%2Fmicrobean-datasource-cdi-hikaricp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microbean%2Fmicrobean-datasource-cdi-hikaricp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microbean%2Fmicrobean-datasource-cdi-hikaricp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/microbean","download_url":"https://codeload.github.com/microbean/microbean-datasource-cdi-hikaricp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247063841,"owners_count":20877512,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cdi","hikari-connection-pool","hikari-datasource","hikaricp"],"created_at":"2024-12-16T22:19:24.724Z","updated_at":"2025-04-03T19:26:13.511Z","avatar_url":"https://github.com/microbean.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# microBean Hikari Connection Pool CDI Extension\n\n[![Build Status](https://travis-ci.org/microbean/microbean-datasource-cdi-hikaricp.svg?branch=master)](https://travis-ci.org/microbean/microbean-datasource-cdi-hikaricp)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.microbean/microbean-datasource-cdi-hikaricp/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.microbean/microbean-datasource-cdi-hikaricp)\n\nThe microBean Hikari Connection Pool CDI Extension project\nintegrates the [Hikari connection pool][hikaricp] into [CDI 2.0 SE\nenvironments][cdi].\n\n# Installation\n\nTo install the microBean Hikari Connection Pool CDI Extension\nproject, ensure that it and its dependencies are present on the\nclasspath at runtime.  In Maven, your dependency stanza should look\nlike this:\n\n    \u003cdependency\u003e\n      \u003cgroupId\u003eorg.microbean\u003c/groupId\u003e\n      \u003cartifactId\u003emicrobean-datasource-cdi-hikaricp\u003c/artifactId\u003e\n      \u003c!-- See http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.microbean%22%20AND%20a%3A%22microbean-datasource-cdi-hikaricp%22 for available releases. --\u003e\n      \u003cversion\u003e0.1.4\u003c/version\u003e\n      \u003ctype\u003ejar\u003c/type\u003e\n      \u003cscope\u003eruntime\u003c/scope\u003e\n    \u003c/dependency\u003e\n    \nReleases are [available in Maven Central][maven-central].  Snapshots\nare available in [Sonatype Snapshots][sonatype-snapshots].\n\nYou will also need a JDBC driver implementation on your classpath as\nwell at runtime.\n\n# Usage\n\nThe microBean Hikari Connection Pool CDI Extension project works,\nessentially, by satisfying `DataSource` injection points.  That is, in\nyour [CDI 2.0 SE][cdi] application somewhere, if you do:\n\n    @Inject\n    @Named(\"test\")\n    private DataSource ds;\n    \n...this project will arrange for a `DataSource` named `test` [backed\nby the Hikari connection pool][hikari-datasource] to be assigned to\nthis `ds` field in [application scope][application-scope].  If you do:\n\n    @Inject\n    private DataSource orders;\n    \n...this project will arrange for a `DataSource` named `orders` [backed\nby the Hikari connection pool][hikari-datasource] to be assigned to\nthis `orders` field in [application scope][application-scope].\n\nFor such injection points to be satisfied, the microBean Hikari\nConnection Pool CDI Extension project needs to understand how to\nconfigure any particular named `DataSource` implementation that will\nbe injected.  To do this, it looks for [`DataSourceDefinition`][dsd]\nannotations and `datasource.properties` classpath resources.\n\nAny type-level `DataSourceDefinition` annotations that are encountered\nare processed.  Then `datasource.properties` [classpath\nresources][classpath-resources] are sought and loaded, and their\nproperties are processed in the manner described below.\n\nProperties in each `datasource.properties` file are inspected if they\nstart with either `javax.sql.DataSource.` or\n`com.zaxxer.hikari.HikariDataSource.`, followed by a datasource name\nthat does not contain a period ('`.`'), followed by a period ('`.`'),\nfollowed by the name of a [Hikari connection pool configuration\nsetting][hikaricp-config].\n\nProperties are not read until all `datasource.properties` [classpath\nresources][classpath-resources] have been effectively combined together.\n\n`datasource.properties` [classpath resources][classpath-resources]\noverride [`DataSourceDefinition`][dsd] annotation values.\n\nFor each distinct data source name, a\n[`HikariDataSource`][hikari-datasource] is created and made available\nin [application scope][application-scope] with a [`Named`][named]\nqualifier whose [value][named-value] is set to the data source name.\nThat `DataSource` implementation will then be configured by applying\nall the relevant property suffixes after the first `.dataSource.`\nstring.  So, for example, the property\n`javax.sql.DataSource.test.dataSource.url=jdbc:h2:mem:temp` will\nresult in a `HikariDataSource` implementation named `test`, with the\n[Hikari connection pool setting][hikaricp-config] named\n`dataSource.url` set to `jdbc:h2:mem:temp`.\n\nHere is an example of a `datasource.properties` file that works with\nthe [in-memory variant of the H2 database][h2-mem]:\n\n    javax.sql.DataSource.test.dataSourceClassName=org.h2.jdbcx.JdbcDataSource\n    javax.sql.DataSource.test.dataSource.url=jdbc:h2:mem:test\n    javax.sql.DataSource.test.username=sa\n    javax.sql.DataSource.test.password=\n\nHere is an example of a similar `datasource.properties` file that\ndeclares two datasources:\n\n    javax.sql.DataSource.test.dataSourceClassName=org.h2.jdbcx.JdbcDataSource\n    javax.sql.DataSource.test.dataSource.url=jdbc:h2:mem:test\n    javax.sql.DataSource.test.username=sa\n    javax.sql.DataSource.test.password=\n    \n    javax.sql.DataSource.prod.dataSourceClassName=org.h2.jdbcx.JdbcDataSource\n    javax.sql.DataSource.prod.dataSource.url=jdbc:h2:mem:test\n    javax.sql.DataSource.prod.username=production\n    javax.sql.DataSource.prod.password=s3kret\n\n[hikaricp]: http://brettwooldridge.github.io/HikariCP/\n[cdi]: http://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#part_2\n[maven-central]: http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.microbean%22%20AND%20a%3A%22microbean-datasource-cdi-hikaricp%22\n[sonatype-snapshots]: https://oss.sonatype.org/content/repositories/snapshots/org/microbean/microbean-datasource-cdi-hikaricp/\n[application-scope]: http://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#application_context_se\n[hikari-datasource]: https://static.javadoc.io/com.zaxxer/HikariCP/3.2.0/com/zaxxer/hikari/HikariDataSource.html\n[dsd]: https://static.javadoc.io/javax/javaee-api/8.0/javax/annotation/sql/DataSourceDefinition.html\n[classpath-resources]: https://docs.oracle.com/javase/8/docs/api/java/lang/ClassLoader.html#getResources-java.lang.String-\n[hikaricp-config]: https://github.com/brettwooldridge/HikariCP/blob/dev/README.md#configuration-knobs-baby\n[named]: https://static.javadoc.io/javax/javaee-api/8.0/javax/inject/Named.html\n[named-value]: https://static.javadoc.io/javax/javaee-api/8.0/javax/inject/Named.html#value--\n[h2-mem]: http://www.h2database.com/html/features.html#in_memory_databases\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrobean%2Fmicrobean-datasource-cdi-hikaricp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicrobean%2Fmicrobean-datasource-cdi-hikaricp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrobean%2Fmicrobean-datasource-cdi-hikaricp/lists"}