|
|
|
|
@ -34,7 +34,6 @@ import org.springframework.context.annotation.Bean;
@@ -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;
@@ -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 {
@@ -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 {
@@ -135,7 +137,7 @@ public class CouchbaseAutoConfiguration {
|
|
|
|
|
static class BootstrapHostsProperty { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ConditionalOnBean(CouchbaseConfigurer.class) |
|
|
|
|
@ConditionalOnBean(type = "org.springframework.data.couchbase.config.CouchbaseConfigurer") |
|
|
|
|
static class CouchbaseConfigurerAvailable { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|