|
|
@ -34,7 +34,6 @@ import org.springframework.context.annotation.Bean;
|
|
|
|
import org.springframework.context.annotation.Conditional;
|
|
|
|
import org.springframework.context.annotation.Conditional;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import org.springframework.context.annotation.Primary;
|
|
|
|
import org.springframework.context.annotation.Primary;
|
|
|
|
import org.springframework.data.couchbase.config.CouchbaseConfigurer;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* {@link EnableAutoConfiguration Auto-Configuration} for Couchbase.
|
|
|
|
* {@link EnableAutoConfiguration Auto-Configuration} for Couchbase.
|
|
|
@ -44,13 +43,14 @@ import org.springframework.data.couchbase.config.CouchbaseConfigurer;
|
|
|
|
* @since 1.4.0
|
|
|
|
* @since 1.4.0
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Configuration
|
|
|
|
@Configuration
|
|
|
|
@ConditionalOnClass({ CouchbaseBucket.class, Cluster.class, CouchbaseConfigurer.class })
|
|
|
|
@ConditionalOnClass({ CouchbaseBucket.class, Cluster.class })
|
|
|
|
@Conditional(CouchbaseAutoConfiguration.CouchbaseCondition.class)
|
|
|
|
@Conditional(CouchbaseAutoConfiguration.CouchbaseCondition.class)
|
|
|
|
@EnableConfigurationProperties(CouchbaseProperties.class)
|
|
|
|
@EnableConfigurationProperties(CouchbaseProperties.class)
|
|
|
|
public class CouchbaseAutoConfiguration {
|
|
|
|
public class CouchbaseAutoConfiguration {
|
|
|
|
|
|
|
|
|
|
|
|
@Configuration
|
|
|
|
@Configuration
|
|
|
|
@ConditionalOnMissingBean({ CouchbaseConfigurer.class, CouchbaseConfiguration.class })
|
|
|
|
@ConditionalOnMissingBean(value = CouchbaseConfiguration.class,
|
|
|
|
|
|
|
|
type = "org.springframework.data.couchbase.config.CouchbaseConfigurer")
|
|
|
|
public static class CouchbaseConfiguration {
|
|
|
|
public static class CouchbaseConfiguration {
|
|
|
|
|
|
|
|
|
|
|
|
private final CouchbaseProperties properties;
|
|
|
|
private final CouchbaseProperties properties;
|
|
|
@ -122,8 +122,10 @@ public class CouchbaseAutoConfiguration {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Determine if Couchbase should be configured. This happens if either the
|
|
|
|
* 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.
|
|
|
|
* "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 {
|
|
|
|
static class CouchbaseCondition extends AnyNestedCondition {
|
|
|
|
|
|
|
|
|
|
|
@ -135,7 +137,7 @@ public class CouchbaseAutoConfiguration {
|
|
|
|
static class BootstrapHostsProperty {
|
|
|
|
static class BootstrapHostsProperty {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ConditionalOnBean(CouchbaseConfigurer.class)
|
|
|
|
@ConditionalOnBean(type = "org.springframework.data.couchbase.config.CouchbaseConfigurer")
|
|
|
|
static class CouchbaseConfigurerAvailable {
|
|
|
|
static class CouchbaseConfigurerAvailable {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|