{"id":25490230,"url":"https://github.com/al-assad/spring-phoenix-jdbc-sample","last_synced_at":"2026-04-15T15:35:58.846Z","repository":{"id":42120491,"uuid":"213421661","full_name":"Al-assad/spring-phoenix-jdbc-sample","owner":"Al-assad","description":"Apache Phoenix5.0 通过 JdbcTemplate 的方式集成到 Spring-Boot 的示例代码","archived":false,"fork":false,"pushed_at":"2024-09-25T14:39:52.000Z","size":10,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-18T23:35:02.771Z","etag":null,"topics":["jdbc","jdbctemplate","phoenix","spring","spring-boot"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Al-assad.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-10-07T15:36:23.000Z","updated_at":"2022-05-17T08:18:02.000Z","dependencies_parsed_at":"2025-05-18T23:34:39.097Z","dependency_job_id":"a42810d5-6086-4cb0-aac5-6ca739e6faa7","html_url":"https://github.com/Al-assad/spring-phoenix-jdbc-sample","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Al-assad/spring-phoenix-jdbc-sample","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Al-assad%2Fspring-phoenix-jdbc-sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Al-assad%2Fspring-phoenix-jdbc-sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Al-assad%2Fspring-phoenix-jdbc-sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Al-assad%2Fspring-phoenix-jdbc-sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Al-assad","download_url":"https://codeload.github.com/Al-assad/spring-phoenix-jdbc-sample/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Al-assad%2Fspring-phoenix-jdbc-sample/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265262187,"owners_count":23736407,"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":["jdbc","jdbctemplate","phoenix","spring","spring-boot"],"created_at":"2025-02-18T21:27:36.918Z","updated_at":"2026-04-15T15:35:58.812Z","avatar_url":"https://github.com/Al-assad.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# spring-phoenix-jdbc-sample\n\nApache Phoenix5.0 通过 JdbcTemplate 的方式集成到 Spring-Boot 的示例代码\n\n\u003cbr\u003e\n\n### 各组件版本\n\n* Spring-Boot： 2.1.5.RELEASE\n* Apache Phoenix：5.0.0\n* Hadoop：2.7.4\n\n\u003cbr\u003e\n\n### 数据源配置说明\n\n数据源使用了 Spring-Boot 默认的 `HikariDataSource` ，主要工作在于对 `phoenix`  配置一个数据源，并将该数据源关联到 `JdbcTemplate` 的一个单例上。\n\n这部分的代码如下：\n\n```java\n@Configuration\n@EnableConfigurationProperties(PhoenixDataSourceProperties.class)\n@ConditionalOnClass(JdbcTemplate.class)\npublic class DataSourceConfig {\n    \n    private PhoenixDataSourceProperties phoenixDataSourceProperties;\n    @Autowired\n    public void setPhoenixDataSourceProperties(PhoenixDataSourceProperties phoenixDataSourceProperties) {\n        this.phoenixDataSourceProperties = phoenixDataSourceProperties;\n    }\n    \n    /**\n     * phoenix 数据源配置\n     */\n    @Bean\n    public DataSource phoenixDataSource(){\n        HikariDataSource dataSource = new HikariDataSource();\n        dataSource.setDriverClassName(phoenixDataSourceProperties.getDriverClassName());\n        dataSource.setJdbcUrl(phoenixDataSourceProperties.getUrl());\n        // 由于 phoenix 驱动不会自动 commit，需要加入默认的 auto commit 设置，否则更新操作的数据会缓存在本地知直到缓冲区满\n        dataSource.setAutoCommit(true);\n        return dataSource;\n    }\n    \n    /**\n     * Phoenix JdbcTemplate 配置\n     */\n    @Bean\n    public JdbcTemplate phoenixTemplate(DataSource phoenixDataSource){\n        JdbcTemplate jdbcTemplate = new JdbcTemplate();\n        jdbcTemplate.setDataSource(phoenixDataSource);\n        return jdbcTemplate;\n    }\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fal-assad%2Fspring-phoenix-jdbc-sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fal-assad%2Fspring-phoenix-jdbc-sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fal-assad%2Fspring-phoenix-jdbc-sample/lists"}