pom.xml引入依赖,核心内容如下
注意hbase 版本,跟你要连接的服务端保持一致
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.5.RELEASE</version>
<relativePath/>
</parent>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-shaded-client</artifactId>
<version>2.1.9</version>
</dependency>
application.properties加入配置
##hbase所使用的zookeeper
hbase.config.hbase.zookeeper.quorum=host1,host2,host3
hbase.config.hbase.zookeeper.property.clientPort=2181
java配置
HBaseProperties.java
import org.springframework.boot.context.properties.ConfigurationProperties;
import java.util.Map