Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
76f1ca41
Commit
76f1ca41
authored
Jul 30, 2015
by
Eddú Meléndez
Committed by
Stephane Nicoll
Feb 16, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Couchbase support
Closes gh-3498
parent
ecf11e02
Changes
30
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
1006 additions
and
2 deletions
+1006
-2
pom.xml
spring-boot-actuator/pom.xml
+5
-0
HealthIndicatorAutoConfiguration.java
...tuate/autoconfigure/HealthIndicatorAutoConfiguration.java
+24
-1
CouchbaseHealthIndicator.java
...amework/boot/actuate/health/CouchbaseHealthIndicator.java
+47
-0
HealthIndicatorAutoConfigurationTests.java
.../autoconfigure/HealthIndicatorAutoConfigurationTests.java
+27
-0
pom.xml
spring-boot-autoconfigure/pom.xml
+11
-0
CouchbaseAutoConfiguration.java
...t/autoconfigure/couchbase/CouchbaseAutoConfiguration.java
+77
-0
CouchbaseProperties.java
...ork/boot/autoconfigure/couchbase/CouchbaseProperties.java
+69
-0
package-info.java
...gframework/boot/autoconfigure/couchbase/package-info.java
+20
-0
CouchbaseRepositoriesAutoConfiguration.java
...ata/couchbase/CouchbaseRepositoriesAutoConfiguration.java
+44
-0
CouchbaseRepositoriesRegistrar.java
...figure/data/couchbase/CouchbaseRepositoriesRegistrar.java
+56
-0
package-info.java
...ework/boot/autoconfigure/data/couchbase/package-info.java
+20
-0
spring.factories
...utoconfigure/src/main/resources/META-INF/spring.factories
+2
-0
CouchbaseAutoConfigurationTests.java
...oconfigure/couchbase/CouchbaseAutoConfigurationTests.java
+62
-0
CityCouchbaseRepository.java
...configure/data/alt/couchbase/CityCouchbaseRepository.java
+26
-0
CouchbaseRepositoriesAutoConfigurationTests.java
...ouchbase/CouchbaseRepositoriesAutoConfigurationTests.java
+157
-0
City.java
...ramework/boot/autoconfigure/data/couchbase/city/City.java
+33
-0
CityRepository.java
...oot/autoconfigure/data/couchbase/city/CityRepository.java
+23
-0
pom.xml
spring-boot-dependencies/pom.xml
+17
-1
appendix-application-properties.adoc
...cs/src/main/asciidoc/appendix-application-properties.adoc
+5
-0
README.adoc
spring-boot-samples/README.adoc
+2
-0
pom.xml
spring-boot-samples/pom.xml
+1
-0
pom.xml
...ng-boot-samples/spring-boot-sample-data-couchbase/pom.xml
+54
-0
SampleCouchbaseApplication.java
...ava/sample/data/couchbase/SampleCouchbaseApplication.java
+49
-0
User.java
...a-couchbase/src/main/java/sample/data/couchbase/User.java
+68
-0
UserRepository.java
...e/src/main/java/sample/data/couchbase/UserRepository.java
+23
-0
SampleCouchbaseApplicationTests.java
...ample/data/couchbase/SampleCouchbaseApplicationTests.java
+47
-0
application.properties
...-data-couchbase/src/test/resources/application.properties
+3
-0
pom.xml
spring-boot-starters/pom.xml
+1
-0
pom.xml
...-boot-starters/spring-boot-starter-data-couchbase/pom.xml
+32
-0
spring.provides
...ata-couchbase/src/main/resources/META-INF/spring.provides
+1
-0
No files found.
spring-boot-actuator/pom.xml
View file @
76f1ca41
...
...
@@ -151,6 +151,11 @@
<artifactId>
spring-data-cassandra
</artifactId>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
org.springframework.data
</groupId>
<artifactId>
spring-data-couchbase
</artifactId>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
org.springframework.data
</groupId>
<artifactId>
spring-data-mongodb
</artifactId>
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfiguration.java
View file @
76f1ca41
...
...
@@ -22,6 +22,7 @@ import java.util.Map;
import
javax.jms.ConnectionFactory
;
import
javax.sql.DataSource
;
import
com.couchbase.client.java.Bucket
;
import
com.datastax.driver.core.Cluster
;
import
org.apache.solr.client.solrj.SolrClient
;
import
org.elasticsearch.client.Client
;
...
...
@@ -32,6 +33,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.boot.actuate.health.ApplicationHealthIndicator
;
import
org.springframework.boot.actuate.health.CassandraHealthIndicator
;
import
org.springframework.boot.actuate.health.CompositeHealthIndicator
;
import
org.springframework.boot.actuate.health.CouchbaseHealthIndicator
;
import
org.springframework.boot.actuate.health.DataSourceHealthIndicator
;
import
org.springframework.boot.actuate.health.DiskSpaceHealthIndicator
;
import
org.springframework.boot.actuate.health.DiskSpaceHealthIndicatorProperties
;
...
...
@@ -54,6 +56,7 @@ import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfigurati
import
org.springframework.boot.autoconfigure.condition.ConditionalOnBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.boot.autoconfigure.couchbase.CouchbaseAutoConfiguration
;
import
org.springframework.boot.autoconfigure.data.cassandra.CassandraDataAutoConfiguration
;
import
org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration
;
import
org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration
;
...
...
@@ -71,6 +74,7 @@ import org.springframework.context.annotation.Bean;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.core.ResolvableType
;
import
org.springframework.data.cassandra.core.CassandraOperations
;
import
org.springframework.data.couchbase.core.CouchbaseOperations
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.data.redis.connection.RedisConnectionFactory
;
import
org.springframework.jdbc.core.JdbcTemplate
;
...
...
@@ -84,11 +88,12 @@ import org.springframework.mail.javamail.JavaMailSenderImpl;
* @author Stephane Nicoll
* @author Phillip Webb
* @author Tommy Ludwig
* @author Eddú Meléndez
* @since 1.1.0
*/
@Configuration
@AutoConfigureBefore
({
EndpointAutoConfiguration
.
class
})
@AutoConfigureAfter
({
CassandraAutoConfiguration
.
class
,
@AutoConfigureAfter
({
C
ouchbaseAutoConfiguration
.
class
,
C
assandraAutoConfiguration
.
class
,
CassandraDataAutoConfiguration
.
class
,
DataSourceAutoConfiguration
.
class
,
MongoAutoConfiguration
.
class
,
MongoDataAutoConfiguration
.
class
,
RedisAutoConfiguration
.
class
,
RabbitAutoConfiguration
.
class
,
...
...
@@ -176,6 +181,24 @@ public class HealthIndicatorAutoConfiguration {
}
@Configuration
@ConditionalOnClass
({
CouchbaseOperations
.
class
,
Bucket
.
class
})
@ConditionalOnBean
(
CouchbaseOperations
.
class
)
@ConditionalOnEnabledHealthIndicator
(
"couchbase"
)
public
static
class
CouchbaseHealthIndicatorConfiguration
extends
CompositeHealthIndicatorConfiguration
<
CouchbaseHealthIndicator
,
CouchbaseOperations
>
{
@Autowired
private
Map
<
String
,
CouchbaseOperations
>
couchbaseOperations
;
@Bean
@ConditionalOnMissingBean
(
name
=
"couchbaseHealthIndicator"
)
public
HealthIndicator
couchbaseHealthIndicator
()
{
return
createHealthIndicator
(
this
.
couchbaseOperations
);
}
}
@Configuration
@ConditionalOnClass
(
JdbcTemplate
.
class
)
@ConditionalOnBean
(
DataSource
.
class
)
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/CouchbaseHealthIndicator.java
0 → 100644
View file @
76f1ca41
/*
* Copyright 2012-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
boot
.
actuate
.
health
;
import
java.util.List
;
import
com.couchbase.client.java.util.features.Version
;
import
org.springframework.data.couchbase.core.CouchbaseOperations
;
import
org.springframework.util.Assert
;
/**
* {@link HealthIndicator} for Couchbase.
*
* @author Eddú Meléndez
* @since 1.4.0
*/
public
class
CouchbaseHealthIndicator
extends
AbstractHealthIndicator
{
private
CouchbaseOperations
couchbaseOperations
;
public
CouchbaseHealthIndicator
(
CouchbaseOperations
couchbaseOperations
)
{
Assert
.
notNull
(
couchbaseOperations
,
"CouchbaseOperations must not be null"
);
this
.
couchbaseOperations
=
couchbaseOperations
;
}
@Override
protected
void
doHealthCheck
(
Health
.
Builder
builder
)
throws
Exception
{
List
<
Version
>
versions
=
this
.
couchbaseOperations
.
getCouchbaseClusterInfo
().
getAllVersions
();
builder
.
up
().
withDetail
(
"version"
,
versions
.
get
(
0
).
toString
());
}
}
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java
View file @
76f1ca41
...
...
@@ -25,6 +25,7 @@ import org.junit.Test;
import
org.springframework.boot.actuate.health.ApplicationHealthIndicator
;
import
org.springframework.boot.actuate.health.CassandraHealthIndicator
;
import
org.springframework.boot.actuate.health.CouchbaseHealthIndicator
;
import
org.springframework.boot.actuate.health.DataSourceHealthIndicator
;
import
org.springframework.boot.actuate.health.DiskSpaceHealthIndicator
;
import
org.springframework.boot.actuate.health.ElasticsearchHealthIndicator
;
...
...
@@ -56,6 +57,7 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.cassandra.core.CassandraOperations
;
import
org.springframework.data.couchbase.core.CouchbaseOperations
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
mockito
.
Mockito
.
mock
;
...
...
@@ -66,6 +68,7 @@ import static org.mockito.Mockito.mock;
* @author Christian Dupuis
* @author Stephane Nicoll
* @author Andy Wilkinson
* @author Eddú Meléndez
*/
public
class
HealthIndicatorAutoConfigurationTests
{
...
...
@@ -436,6 +439,19 @@ public class HealthIndicatorAutoConfigurationTests {
.
isEqualTo
(
CassandraHealthIndicator
.
class
);
}
@Test
public
void
couchbaseHealthIndicator
()
throws
Exception
{
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"management.health.diskspace.enabled:false"
);
this
.
context
.
register
(
CouchbaseConfiguration
.
class
,
ManagementServerProperties
.
class
,
HealthIndicatorAutoConfiguration
.
class
);
this
.
context
.
refresh
();
Map
<
String
,
HealthIndicator
>
beans
=
this
.
context
.
getBeansOfType
(
HealthIndicator
.
class
);
assertThat
(
beans
.
size
()).
isEqualTo
(
1
);
assertThat
(
beans
.
values
().
iterator
().
next
().
getClass
()).
isEqualTo
(
CouchbaseHealthIndicator
.
class
);
}
@Configuration
@EnableConfigurationProperties
protected
static
class
DataSourceConfig
{
...
...
@@ -476,4 +492,15 @@ public class HealthIndicatorAutoConfigurationTests {
}
@Configuration
protected
static
class
CouchbaseConfiguration
{
@Bean
public
CouchbaseOperations
couchbaseOperations
()
{
CouchbaseOperations
operations
=
mock
(
CouchbaseOperations
.
class
);
return
operations
;
}
}
}
spring-boot-autoconfigure/pom.xml
View file @
76f1ca41
...
...
@@ -325,6 +325,17 @@
<artifactId>
spring-batch-core
</artifactId>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
org.springframework.data
</groupId>
<artifactId>
spring-data-couchbase
</artifactId>
<optional>
true
</optional>
<exclusions>
<exclusion>
<groupId>
org.slf4j
</groupId>
<artifactId>
jcl-over-slf4j
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.springframework.data
</groupId>
<artifactId>
spring-data-jpa
</artifactId>
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseAutoConfiguration.java
0 → 100644
View file @
76f1ca41
/*
* Copyright 2012-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
boot
.
autoconfigure
.
couchbase
;
import
java.util.Arrays
;
import
java.util.List
;
import
javax.validation.Validator
;
import
com.couchbase.client.java.CouchbaseBucket
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.couchbase.config.AbstractCouchbaseConfiguration
;
import
org.springframework.data.couchbase.config.CouchbaseBucketFactoryBean
;
import
org.springframework.data.couchbase.core.mapping.event.ValidatingCouchbaseEventListener
;
/**
* {@link org.springframework.boot.autoconfigure.EnableAutoConfiguration
* Auto-Configuration} for Couchbase.
*
* @author Eddú Meléndez
* @since 1.4.0
*/
@Configuration
@ConditionalOnClass
({
CouchbaseBucket
.
class
,
CouchbaseBucketFactoryBean
.
class
})
@EnableConfigurationProperties
(
CouchbaseProperties
.
class
)
public
class
CouchbaseAutoConfiguration
{
@Bean
@ConditionalOnBean
(
Validator
.
class
)
public
ValidatingCouchbaseEventListener
validationEventListener
(
Validator
validator
)
{
return
new
ValidatingCouchbaseEventListener
(
validator
);
}
@Configuration
static
class
CouchbaseConfiguration
extends
AbstractCouchbaseConfiguration
{
@Autowired
private
CouchbaseProperties
properties
;
@Override
protected
List
<
String
>
getBootstrapHosts
()
{
return
Arrays
.
asList
(
this
.
properties
.
getHosts
());
}
@Override
protected
String
getBucketName
()
{
return
this
.
properties
.
getBucketName
();
}
@Override
protected
String
getBucketPassword
()
{
return
this
.
properties
.
getBucketPassword
();
}
}
}
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseProperties.java
0 → 100644
View file @
76f1ca41
/*
* Copyright 2012-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
boot
.
autoconfigure
.
couchbase
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
/**
* Configuration properties for Couchbase.
*
* @author Eddú Meléndez
* @since 1.4.0
*/
@ConfigurationProperties
(
prefix
=
"spring.data.couchbase"
)
public
class
CouchbaseProperties
{
/**
* Couchabase server hosts.
*/
private
String
[]
hosts
;
/**
* Couchbase bucket name.
*/
private
String
bucketName
;
/**
* Couchbase bucket password.
*/
private
String
bucketPassword
;
public
String
[]
getHosts
()
{
return
this
.
hosts
;
}
public
void
setHosts
(
String
[]
hosts
)
{
this
.
hosts
=
hosts
;
}
public
String
getBucketName
()
{
return
this
.
bucketName
;
}
public
void
setBucketName
(
String
bucketName
)
{
this
.
bucketName
=
bucketName
;
}
public
String
getBucketPassword
()
{
return
this
.
bucketPassword
;
}
public
void
setBucketPassword
(
String
bucketPassword
)
{
this
.
bucketPassword
=
bucketPassword
;
}
}
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/package-info.java
0 → 100644
View file @
76f1ca41
/*
* Copyright 2012-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Auto-configuration for Couchbase.
*/
package
org
.
springframework
.
boot
.
autoconfigure
.
couchbase
;
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/couchbase/CouchbaseRepositoriesAutoConfiguration.java
0 → 100644
View file @
76f1ca41
/*
* Copyright 2012-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
boot
.
autoconfigure
.
data
.
couchbase
;
import
com.couchbase.client.java.Bucket
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.data.couchbase.repository.CouchbaseRepository
;
import
org.springframework.data.couchbase.repository.support.CouchbaseRepositoryFactoryBean
;
/**
* {@link EnableAutoConfiguration Auto-configuration} for Spring Data's Couchbase
* Repositories.
*
* @author Eddú Meléndez
* @since 1.4.0
*/
@Configuration
@ConditionalOnClass
({
Bucket
.
class
,
CouchbaseRepository
.
class
})
@ConditionalOnProperty
(
prefix
=
"spring.data.couchbase.repositories"
,
name
=
"enabled"
,
havingValue
=
"true"
,
matchIfMissing
=
true
)
@ConditionalOnMissingBean
(
CouchbaseRepositoryFactoryBean
.
class
)
@Import
(
CouchbaseRepositoriesRegistrar
.
class
)
public
class
CouchbaseRepositoriesAutoConfiguration
{
}
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/couchbase/CouchbaseRepositoriesRegistrar.java
0 → 100644
View file @
76f1ca41
/*
* Copyright 2012-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
boot
.
autoconfigure
.
data
.
couchbase
;
import
java.lang.annotation.Annotation
;
import
org.springframework.boot.autoconfigure.data.AbstractRepositoryConfigurationSourceSupport
;
import
org.springframework.context.annotation.ImportBeanDefinitionRegistrar
;
import
org.springframework.data.couchbase.repository.config.CouchbaseRepositoryConfigurationExtension
;
import
org.springframework.data.couchbase.repository.config.EnableCouchbaseRepositories
;
import
org.springframework.data.repository.config.RepositoryConfigurationExtension
;
/**
* {@link ImportBeanDefinitionRegistrar} used to auto-configure Spring Data Couchbase
* Repositories.
*
* @author Eddú Meléndez
* @since 1.4.0
*/
public
class
CouchbaseRepositoriesRegistrar
extends
AbstractRepositoryConfigurationSourceSupport
{
@Override
protected
Class
<?
extends
Annotation
>
getAnnotation
()
{
return
EnableCouchbaseRepositories
.
class
;
}
@Override
protected
Class
<?>
getConfiguration
()
{
return
EnableCouchbaseRepositoriesConfiguration
.
class
;
}
@Override
protected
RepositoryConfigurationExtension
getRepositoryConfigurationExtension
()
{
return
new
CouchbaseRepositoryConfigurationExtension
();
}
@EnableCouchbaseRepositories
private
static
class
EnableCouchbaseRepositoriesConfiguration
{
}
}
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/couchbase/package-info.java
0 → 100644
View file @
76f1ca41
/*
* Copyright 2012-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Auto-configuration for Spring Data Couchbase.
*/
package
org
.
springframework
.
boot
.
autoconfigure
.
data
.
couchbase
;
spring-boot-autoconfigure/src/main/resources/META-INF/spring.factories
View file @
76f1ca41
...
...
@@ -19,9 +19,11 @@ org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration,\
org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration,\
org.springframework.boot.autoconfigure.cloud.CloudAutoConfiguration,\
org.springframework.boot.autoconfigure.context.ConfigurationPropertiesAutoConfiguration,\
org.springframework.boot.autoconfigure.couchbase.CouchbaseAutoConfiguration,\
org.springframework.boot.autoconfigure.dao.PersistenceExceptionTranslationAutoConfiguration,\
org.springframework.boot.autoconfigure.data.cassandra.CassandraDataAutoConfiguration,\
org.springframework.boot.autoconfigure.data.cassandra.CassandraRepositoriesAutoConfiguration,\
org.springframework.boot.autoconfigure.data.couchbase.CouchbaseRepositoriesAutoConfiguration,\
org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration,\
org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoConfiguration,\
org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchRepositoriesAutoConfiguration,\
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseAutoConfigurationTests.java
0 → 100644
View file @
76f1ca41
/*
* Copyright 2012-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
boot
.
autoconfigure
.
couchbase
;
import
org.junit.After
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.junit.rules.ExpectedException
;
import
org.springframework.beans.factory.BeanCreationException
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.test.EnvironmentTestUtils
;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
/**
* Tests for {@link CouchbaseAutoConfiguration}
*
* @author Eddú Meléndez
*/
public
class
CouchbaseAutoConfigurationTests
{
@Rule
public
ExpectedException
thrown
=
ExpectedException
.
none
();
private
AnnotationConfigApplicationContext
context
;
@After
public
void
close
()
{
if
(
this
.
context
!=
null
)
{
this
.
context
.
close
();
}
}
@Test
public
void
validateProperties
()
{
this
.
context
=
new
AnnotationConfigApplicationContext
();
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"spring.data.couchbase.hosts=localhost"
,
"spring.data.couchbase.bucket-name=test"
,
"spring.data.couchbase.bucket-password=test"
);
this
.
context
.
register
(
PropertyPlaceholderAutoConfiguration
.
class
,
CouchbaseAutoConfiguration
.
class
);
this
.
thrown
.
expect
(
BeanCreationException
.
class
);
this
.
thrown
.
expectMessage
(
"Connection refused"
);
this
.
context
.
refresh
();
}
}
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/alt/couchbase/CityCouchbaseRepository.java
0 → 100644
View file @
76f1ca41
/*
* Copyright 2012-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
boot
.
autoconfigure
.
data
.
alt
.
couchbase
;
import
org.springframework.boot.autoconfigure.data.couchbase.city.City
;
import
org.springframework.data.repository.Repository
;
/**
* @author Eddú Meléndez
*/
public
interface
CityCouchbaseRepository
extends
Repository
<
City
,
Long
>
{
}
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/couchbase/CouchbaseRepositoriesAutoConfigurationTests.java
0 → 100644
View file @
76f1ca41
/*
* Copyright 2012-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
boot
.
autoconfigure
.
data
.
couchbase
;
import
java.util.Collections
;
import
java.util.List
;
import
com.couchbase.client.java.Bucket
;
import
com.couchbase.client.java.Cluster
;
import
com.couchbase.client.java.CouchbaseBucket
;
import
com.couchbase.client.java.CouchbaseCluster
;
import
com.couchbase.client.java.cluster.ClusterInfo
;
import
org.junit.After
;
import
org.junit.Test
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.autoconfigure.TestAutoConfigurationPackage
;
import
org.springframework.boot.autoconfigure.data.couchbase.city.City
;
import
org.springframework.boot.autoconfigure.data.couchbase.city.CityRepository
;
import
org.springframework.boot.autoconfigure.data.empty.EmptyDataPackage
;
import
org.springframework.boot.test.EnvironmentTestUtils
;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.data.couchbase.config.AbstractCouchbaseConfiguration
;
import
org.springframework.data.couchbase.core.CouchbaseTemplate
;
import
org.springframework.data.couchbase.core.WriteResultChecking
;
import
org.springframework.data.couchbase.core.query.Consistency
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
mockito
.
Mockito
.
mock
;
/**
* @author Eddú Meléndez
*/
public
class
CouchbaseRepositoriesAutoConfigurationTests
{
private
AnnotationConfigApplicationContext
context
;
@After
public
void
close
()
{
this
.
context
.
close
();
}
@Test
public
void
testDefaultRepositoryConfiguration
()
throws
Exception
{
this
.
context
=
new
AnnotationConfigApplicationContext
();
addCouchbaseProperties
(
this
.
context
);
this
.
context
.
register
(
TestConfiguration
.
class
,
PropertyPlaceholderAutoConfiguration
.
class
);
this
.
context
.
refresh
();
assertThat
(
this
.
context
.
getBean
(
CityRepository
.
class
)).
isNotNull
();
assertThat
(
this
.
context
.
getBean
(
Bucket
.
class
)).
isNotNull
();
}
@Test
public
void
testNoRepositoryConfiguration
()
throws
Exception
{
this
.
context
=
new
AnnotationConfigApplicationContext
();
addCouchbaseProperties
(
this
.
context
);
this
.
context
.
register
(
EmptyConfiguration
.
class
,
TestConfiguration
.
class
,
PropertyPlaceholderAutoConfiguration
.
class
);
this
.
context
.
refresh
();
assertThat
(
this
.
context
.
getBean
(
Bucket
.
class
)).
isNotNull
();
}
@Test
public
void
templateExists
()
{
this
.
context
=
new
AnnotationConfigApplicationContext
();
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"spring.data.couchbase.hosts=localhost"
,
"spring.data.couchbase.bucket-name=test"
,
"spring.data.couchbase.bucket-password=test"
);
this
.
context
.
register
(
PropertyPlaceholderAutoConfiguration
.
class
,
TestConfiguration
.
class
);
this
.
context
.
refresh
();
assertThat
(
this
.
context
.
getBeanNamesForType
(
CouchbaseTemplate
.
class
).
length
).
isEqualTo
(
1
);
}
private
void
addCouchbaseProperties
(
AnnotationConfigApplicationContext
context
)
{
EnvironmentTestUtils
.
addEnvironment
(
context
,
"spring.data.couchbase.hosts=localhost"
,
"spring.data.couchbase.bucket-name=test"
,
"spring.data.couchbase.bucket-password=test"
);
}
@Configuration
@TestAutoConfigurationPackage
(
City
.
class
)
@Import
(
CouchbaseRepositoriesRegistrar
.
class
)
static
class
TestConfiguration
extends
AbstractCouchbaseConfiguration
{
@Override
protected
List
<
String
>
getBootstrapHosts
()
{
return
Collections
.
singletonList
(
"192.1.2.3"
);
}
@Override
protected
String
getBucketName
()
{
return
"someBucket"
;
}
@Override
protected
String
getBucketPassword
()
{
return
"someBucketPassword"
;
}
@Override
public
Cluster
couchbaseCluster
()
throws
Exception
{
return
mock
(
CouchbaseCluster
.
class
);
}
@Bean
public
ClusterInfo
couchbaseClusterInfo
()
{
return
mock
(
ClusterInfo
.
class
);
}
@Override
public
Bucket
couchbaseClient
()
throws
Exception
{
return
mock
(
CouchbaseBucket
.
class
);
}
@Override
public
CouchbaseTemplate
couchbaseTemplate
()
throws
Exception
{
CouchbaseTemplate
template
=
super
.
couchbaseTemplate
();
template
.
setWriteResultChecking
(
WriteResultChecking
.
LOG
);
return
template
;
}
@Override
protected
Consistency
getDefaultConsistency
()
{
return
Consistency
.
READ_YOUR_OWN_WRITES
;
}
}
@Configuration
@TestAutoConfigurationPackage
(
EmptyDataPackage
.
class
)
protected
static
class
EmptyConfiguration
{
}
}
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/couchbase/city/City.java
0 → 100644
View file @
76f1ca41
/*
* Copyright 2012-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
boot
.
autoconfigure
.
data
.
couchbase
.
city
;
import
com.couchbase.client.java.repository.annotation.Field
;
import
com.couchbase.client.java.repository.annotation.Id
;
import
org.springframework.data.couchbase.core.mapping.Document
;
@Document
public
class
City
{
@Id
private
String
id
;
@Field
private
String
name
;
}
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/couchbase/city/CityRepository.java
0 → 100644
View file @
76f1ca41
/*
* Copyright 2012-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
boot
.
autoconfigure
.
data
.
couchbase
.
city
;
import
org.springframework.data.repository.Repository
;
public
interface
CityRepository
extends
Repository
<
City
,
Long
>
{
}
spring-boot-dependencies/pom.xml
View file @
76f1ca41
...
...
@@ -271,6 +271,11 @@
<artifactId>
spring-boot-starter-data-cassandra
</artifactId>
<version>
1.4.0.BUILD-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-couchbase
</artifactId>
<version>
1.4.0.BUILD-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-elasticsearch
</artifactId>
...
...
@@ -1790,12 +1795,23 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.springframework.data
</groupId>
<artifactId>
spring-data-couchbase
</artifactId>
<version>
${spring-data-couchbase.version}
</version>
</dependency>
<dependency>
<groupId>
org.springframework.data
</groupId>
<artifactId>
spring-data-releasetrain
</artifactId>
<version>
${spring-data-releasetrain.version}
</version>
<scope>
import
</scope>
<type>
pom
</type>
<exclusions>
<exclusion>
<groupId>
org.springframework.data
</groupId>
<artifactId>
spring-data-couchbase
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.springframework.hateoas
</groupId>
...
...
@@ -2239,4 +2255,4 @@
<id>
integration-test
</id>
</profile>
</profiles>
</project>
\ No newline at end of file
</project>
spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc
View file @
76f1ca41
...
...
@@ -488,6 +488,11 @@ content into your application; rather pick only the properties that you need.
spring.data.cassandra.ssl=false # Enable SSL support.
spring.data.cassandra.username= # Login user of the server.
# COUCHBASE ({sc-spring-boot-autoconfigure}/couchbase/CouchbaseProperties.{sc-ext}[CouchbaseProperties])
spring.data.couchbase.hosts= # the db host
spring.data.couchbase.bucket-name= # the bucket name
spring.data.couchbase.bucket-password= # the bucket password
# ELASTICSEARCH ({sc-spring-boot-autoconfigure}/elasticsearch/ElasticsearchProperties.{sc-ext}[ElasticsearchProperties])
spring.data.elasticsearch.cluster-name=elasticsearch # Elasticsearch cluster name.
spring.data.elasticsearch.cluster-nodes= # Comma-separated list of cluster node addresses. If not specified, starts a client node.
...
...
spring-boot-samples/README.adoc
View file @
76f1ca41
...
...
@@ -60,6 +60,8 @@
-- Example showing message-oriented application using HornetQ
* link:spring-boot-sample-batch[spring-boot-sample-batch]
-- Define and run a Batch job in a few lines of code
* link:spring-boot-sample-data-couchbase[spring-boot-sample-data-couchbase]
-- Spring Data Couchbase repositories
* link:spring-boot-sample-data-jpa[spring-boot-sample-data-jpa]
-- Spring Data JPA + Hibernate + HSQLDB
* link:spring-boot-sample-data-mongodb[spring-boot-sample-data-mongodb]
...
...
spring-boot-samples/pom.xml
View file @
76f1ca41
...
...
@@ -33,6 +33,7 @@
<module>
spring-boot-sample-batch
</module>
<module>
spring-boot-sample-cache
</module>
<module>
spring-boot-sample-data-cassandra
</module>
<module>
spring-boot-sample-data-couchbase
</module>
<module>
spring-boot-sample-data-elasticsearch
</module>
<module>
spring-boot-sample-data-gemfire
</module>
<module>
spring-boot-sample-data-jpa
</module>
...
...
spring-boot-samples/spring-boot-sample-data-couchbase/pom.xml
0 → 100644
View file @
76f1ca41
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<artifactId>
spring-boot-samples
</artifactId>
<groupId>
org.springframework.boot
</groupId>
<version>
1.4.0.BUILD-SNAPSHOT
</version>
</parent>
<artifactId>
spring-boot-sample-data-couchbase
</artifactId>
<name>
Spring Boot Data Couchbase Sample
</name>
<description>
Spring Boot Data Couchbase Sample
</description>
<url>
http://projects.spring.io/spring-boot/
</url>
<organization>
<name>
Pivotal Software, Inc.
</name>
<url>
http://www.spring.io
</url>
</organization>
<properties>
<main.basedir>
${basedir}/../..
</main.basedir>
</properties>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-couchbase
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-actuator
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
</plugins>
</build>
</project>
spring-boot-samples/spring-boot-sample-data-couchbase/src/main/java/sample/data/couchbase/SampleCouchbaseApplication.java
0 → 100644
View file @
76f1ca41
/*
* Copyright 2012-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
sample
.
data
.
couchbase
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.CommandLineRunner
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
@SpringBootApplication
public
class
SampleCouchbaseApplication
implements
CommandLineRunner
{
@Autowired
private
UserRepository
userRepository
;
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
SampleCouchbaseApplication
.
class
);
}
@Override
public
void
run
(
String
...
args
)
throws
Exception
{
saveUsers
();
System
.
out
.
println
(
this
.
userRepository
.
findAll
());
}
private
void
saveUsers
()
{
User
user
=
new
User
();
user
.
setFirstname
(
"Alice"
);
user
.
setLastname
(
"Smith"
);
this
.
userRepository
.
save
(
user
);
}
}
spring-boot-samples/spring-boot-sample-data-couchbase/src/main/java/sample/data/couchbase/User.java
0 → 100644
View file @
76f1ca41
/*
* Copyright 2012-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
sample
.
data
.
couchbase
;
import
com.couchbase.client.java.repository.annotation.Field
;
import
com.couchbase.client.java.repository.annotation.Id
;
import
org.springframework.data.couchbase.core.mapping.Document
;
@Document
public
class
User
{
@Id
private
String
id
;
@Field
private
String
firstname
;
@Field
private
String
lastname
;
public
String
getId
()
{
return
this
.
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getFirstname
()
{
return
this
.
firstname
;
}
public
void
setFirstname
(
String
firstname
)
{
this
.
firstname
=
firstname
;
}
public
String
getLastname
()
{
return
this
.
lastname
;
}
public
void
setLastname
(
String
lastname
)
{
this
.
lastname
=
lastname
;
}
@Override
public
String
toString
()
{
return
"User{"
+
"id='"
+
this
.
id
+
'\''
+
", firstname='"
+
this
.
firstname
+
'\''
+
", lastname='"
+
this
.
lastname
+
'\''
+
'}'
;
}
}
spring-boot-samples/spring-boot-sample-data-couchbase/src/main/java/sample/data/couchbase/UserRepository.java
0 → 100644
View file @
76f1ca41
/*
* Copyright 2012-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
sample
.
data
.
couchbase
;
import
org.springframework.data.couchbase.repository.CouchbaseRepository
;
public
interface
UserRepository
extends
CouchbaseRepository
<
User
,
String
>
{
}
spring-boot-samples/spring-boot-sample-data-couchbase/src/test/java/sample/data/couchbase/SampleCouchbaseApplicationTests.java
0 → 100644
View file @
76f1ca41
package
sample
.
data
.
couchbase
;
import
java.net.ConnectException
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.boot.test.OutputCapture
;
import
org.springframework.core.NestedCheckedException
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
public
class
SampleCouchbaseApplicationTests
{
@Rule
public
OutputCapture
outputCapture
=
new
OutputCapture
();
@Test
public
void
testDefaultSettings
()
throws
Exception
{
try
{
new
SpringApplicationBuilder
(
SampleCouchbaseApplication
.
class
)
.
run
();
}
catch
(
RuntimeException
ex
)
{
if
(
serverNotRunning
(
ex
))
{
return
;
}
}
String
output
=
this
.
outputCapture
.
toString
();
assertThat
(
output
).
contains
(
"firstname='Alice', lastname='Smith'"
);
}
private
boolean
serverNotRunning
(
RuntimeException
ex
)
{
@SuppressWarnings
(
"serial"
)
NestedCheckedException
nested
=
new
NestedCheckedException
(
"failed"
,
ex
)
{
};
if
(
nested
.
contains
(
ConnectException
.
class
))
{
Throwable
root
=
nested
.
getRootCause
();
if
(
root
.
getMessage
().
contains
(
"Connection refused"
))
{
return
true
;
}
}
return
false
;
}
}
spring-boot-samples/spring-boot-sample-data-couchbase/src/test/resources/application.properties
0 → 100644
View file @
76f1ca41
spring.data.couchbase.bucket-name
=
mybucket
spring.data.couchbase.bucket-password
=
couchbase
spring.data.couchbase.hosts[0]=127.0.0.1
spring-boot-starters/pom.xml
View file @
76f1ca41
...
...
@@ -28,6 +28,7 @@
<module>
spring-boot-starter-cache
</module>
<module>
spring-boot-starter-cloud-connectors
</module>
<module>
spring-boot-starter-data-cassandra
</module>
<module>
spring-boot-starter-data-couchbase
</module>
<module>
spring-boot-starter-data-elasticsearch
</module>
<module>
spring-boot-starter-data-gemfire
</module>
<module>
spring-boot-starter-data-jpa
</module>
...
...
spring-boot-starters/spring-boot-starter-data-couchbase/pom.xml
0 → 100644
View file @
76f1ca41
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<artifactId>
spring-boot-starters
</artifactId>
<groupId>
org.springframework.boot
</groupId>
<version>
1.4.0.BUILD-SNAPSHOT
</version>
</parent>
<artifactId>
spring-boot-starter-data-couchbase
</artifactId>
<name>
Spring Boot Data Couchbase Starter
</name>
<description>
Spring Boot Data Couchbase Starter
</description>
<url>
http://projects.spring.io/spring-boot/
</url>
<organization>
<name>
Pivotal Software, Inc.
</name>
<url>
http://www.spring.io
</url>
</organization>
<properties>
<main.basedir>
${basedir}/../..
</main.basedir>
</properties>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.data
</groupId>
<artifactId>
spring-data-couchbase
</artifactId>
</dependency>
</dependencies>
</project>
spring-boot-starters/spring-boot-starter-data-couchbase/src/main/resources/META-INF/spring.provides
0 → 100644
View file @
76f1ca41
provides: spring-data-couchbase
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment