Fix Couchbase condition on Spring Data class
This commit reverts 7e2d0fd so that the Couchbase auto-configuration can
work without Spring Data again. It also removes the `Class` reference to
a Spring Data class to a `String` reference to make sure the condition
operates properly when said class isn't on the classpath.
Closes gh-7453
This commit is contained in:
parent
5e79657d4b
commit
5e8ba5cef6
|
|
@ -34,7 +34,6 @@ import org.springframework.context.annotation.Bean;
|
|||
import org.springframework.context.annotation.Conditional;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.data.couchbase.config.CouchbaseConfigurer;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-Configuration} for Couchbase.
|
||||
|
|
@ -44,13 +43,14 @@ import org.springframework.data.couchbase.config.CouchbaseConfigurer;
|
|||
* @since 1.4.0
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnClass({ CouchbaseBucket.class, Cluster.class, CouchbaseConfigurer.class })
|
||||
@ConditionalOnClass({ CouchbaseBucket.class, Cluster.class })
|
||||
@Conditional(CouchbaseAutoConfiguration.CouchbaseCondition.class)
|
||||
@EnableConfigurationProperties(CouchbaseProperties.class)
|
||||
public class CouchbaseAutoConfiguration {
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnMissingBean({ CouchbaseConfigurer.class, CouchbaseConfiguration.class })
|
||||
@ConditionalOnMissingBean(value = CouchbaseConfiguration.class,
|
||||
type = "org.springframework.data.couchbase.config.CouchbaseConfigurer")
|
||||
public static class CouchbaseConfiguration {
|
||||
|
||||
private final CouchbaseProperties properties;
|
||||
|
|
@ -122,8 +122,10 @@ public class CouchbaseAutoConfiguration {
|
|||
|
||||
/**
|
||||
* Determine if Couchbase should be configured. This happens if either the
|
||||
* user-configuration defines a {@link CouchbaseConfigurer} or if at least the
|
||||
* user-configuration defines a {@code CouchbaseConfigurer} or if at least the
|
||||
* "bootstrapHosts" property is specified.
|
||||
* <p>The reason why we check for the presence of {@code CouchbaseConfigurer} is
|
||||
* that it might use {@link CouchbaseProperties} for its internal customization.
|
||||
*/
|
||||
static class CouchbaseCondition extends AnyNestedCondition {
|
||||
|
||||
|
|
@ -135,7 +137,7 @@ public class CouchbaseAutoConfiguration {
|
|||
static class BootstrapHostsProperty {
|
||||
}
|
||||
|
||||
@ConditionalOnBean(CouchbaseConfigurer.class)
|
||||
@ConditionalOnBean(type = "org.springframework.data.couchbase.config.CouchbaseConfigurer")
|
||||
static class CouchbaseConfigurerAvailable {
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue