我正在使用 spring 集成,我正在尝试为 MetaData 创建一个 bean
@Bean
public MetadataStore zkStore(CuratorFramework client) {
return new ZookeeperMetadataStore(client);
}
我收到错误
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'zkStore'; nested exception is java.lang.NoSuchMethodError: 'org.apache.curator.framework.listen.ListenerContainer org.apache.curator.framework.recipes.cache.PathChildrenCache.getListenable()'
进一步挖掘后,我发现类 PathChildrenCache 已被弃用并被接口取代。有什么办法可以运行这段代码。
项目使用的依赖项
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zookeeper-config</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-zookeeper</artifactId>
<version>5.5.2</version>
</dependency>