@Configuration
public class ZKRegistryCenterConfig {
//zookeeper服务地址
@Value("${zookeeper.connString}")
private String ZOOKEEPER_CONNECTION_STRING ;
//定时任务命名空间
@Value("${myjob.namespace}")
private String JOB_NAMESPACE;
//zk的配置及创建注册中心
@Bean(initMethod = "init")
public ZookeeperRegistryCenter setUpRegistryCenter(){
//zk的配置
ZookeeperConfiguration zookeeperConfiguration = new
ZookeeperConfiguration(ZOOKEEPER_CONNECTION_STRING, JOB_NAMESPACE);
//创建注册中心
ZookeeperRegistryCenter zookeeperRegistryCenter = new
ZookeeperRegistryCenter(zookeeperConfiguration);
return zookeeperRegistryCenter;
}
}
zookeeper注册中心
最新推荐文章于 2024-09-03 02:15:12 发布