Spring LDAP和Spring Cloud Consul是否可以一起工作?

时间:2018-12-07 19:10:48

标签: spring spring-boot consul spring-ldap spring-cloud-consul

我有一个使用Spring LDAP的项目。我正在尝试将Spring Consul纳入该项目,并一直面临与此相关的问题。

这是pom.xml:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.2.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-consul-all</artifactId>
    <version>2.0.0.RELEASE</version>
</dependency>

这是应用程序属性:

#consul properties
spring.cloud.consul.config.format=PROPERTIES
spring.cloud.consul.discovery.healthCheckPath=/<root>/health
spring.cloud.consul.discovery.healthCheckInterval=15s
spring.application.name=<App_Name>
spring.profiles.active=dev

然后我在SpringBootApplication类上使用@EnableDiscoveryClient启用了发现客户端。

但是,我最终遇到此错误,并且该应用程序从未启动:

***************************
APPLICATION FAILED TO START
***************************

Description:

Field ldapTemplate in com.<package>.config.LdapClient required a bean of type 'org.springframework.ldap.core.LdapTemplate' that could not be found.
    - Bean method 'ldapTemplate' not loaded because @ConditionalOnClass did not find required class 'org.springframework.data.ldap.repository.LdapRepository'


Action:

Consider revisiting the conditions above or defining a bean of type 'org.springframework.ldap.core.LdapTemplate' in your configuration.

Disconnected from the target VM, address: '127.0.0.1:62703', transport: 'socket'

我认为这与Ldap的自动发现有关,引入Consul会导致此问题,但是,我无法指出问题所在。

有人可以帮我解决这个问题吗?

0 个答案:

没有答案