package com.hadoop.common.hbase.starter.boot;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.hadoop.common.hbase.starter.api.HbaseTemplateApi;
/**
* hbase自动注解
*
* @ClassName: HbaseAutoConfiguration
* @Description: hbase注解实现
* @author ZuoLG
* @date 2018年4月8日
*
*/
@Configuration
@EnableConfigurationProperties(HbaseProperties.class)
@ConditionalOnClass(HbaseTemplateApi.class)
public class HbaseAutoConfiguration {
/**
* hbase配置文件
*/
@Autowired
private HbaseProperties hbaseProperties;
/**
* Configuration配置 @Title: getHbaseConfig @return
* org.apache.hadoop.conf.Configuration @throws
*/
public org.apache.hadoop.conf.Configuration getHbaseConfig() {
/* hbase配置 */
final String HBASE_QUORUM = "hbase.zookeeper.quorum";
final String HBASE_ROOTDIR = "hbase.rootdir";
final String HBASE_ZNODE_PARENT = "zookeeper.znode.parent";
org.apache.hadoop.conf.Configuration configuration = HBaseConfiguration.create();
configuration.set(HBASE_QUORUM, this.hbaseProperties.getQuorum());
configuration.set(HBASE_ROOTDIR, this.hbaseProperties.getRootdir());
configuration.set(HBASE_ZNODE_PARENT, this.hbaseProperties.getZnodeParent());
return configuration;
}
/**
* 返回HbaseTemplate @Title: hbaseTemplate @Description: HbaseTemplate @return
* HbaseTemplate @throws
*/
@Bean
@ConditionalOnMissingBean(HbaseTemplateApi.class)
@ConditionalOnProperty(prefix = "spring.data.hbase",value = "enabled",havingValue = "true")
public HbaseTemplateApi hbaseTemplate() {
return new HbaseTemplateApi(getHbaseConfig());
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
基于spring boot 的spring-boot-starter-hbase自动注解实现
共22个文件
prefs:5个
xml:4个
java:3个
需积分: 11 11 下载量 113 浏览量
2018-04-19
14:28:02
上传
评论
收藏 14KB ZIP 举报
温馨提示
基于spring boot 的spring-boot-starter-hbase自动注解实现,HbaseTemplate的直接使用
资源推荐
资源详情
资源评论
收起资源包目录
spring-boot-starter-hbase.zip (22个子文件)
.project 1KB
.factorypath 21KB
pom.xml 3KB
.settings
org.eclipse.wst.common.project.facet.core.prefs.xml 171B
org.eclipse.jdt.apt.core.prefs 69B
.jsdtscope 639B
org.eclipse.core.resources.prefs 155B
org.eclipse.wst.common.component 716B
org.eclipse.wst.validation.prefs 50B
org.eclipse.jdt.core.prefs 489B
org.eclipse.wst.common.project.facet.core.xml 300B
org.eclipse.wst.jsdt.ui.superType.container 49B
org.eclipse.m2e.core.prefs 90B
org.eclipse.wst.jsdt.ui.superType.name 6B
deploy.cmd 333B
src
test
java
main
resources
META-INF
spring.factories 125B
java
com
hadoop
common
hbase
starter
boot
HbaseAutoConfiguration.java 2KB
HbaseProperties.java 813B
api
HbaseTemplateApi.java 505B
webapp
WEB-INF
web.xml 222B
index.jsp 57B
.classpath 1KB
共 22 条
- 1
资源评论
灯下黒
- 粉丝: 17
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功