Spring Data Cloudant Adapter
- Setup by
setup.sh./setup.sh
- Setup by manually
gradle ideato create idea module- double click
spring-data-cloudant.ipr
-
Settings on NON-SRPING-BOOT project if you using
spring-data-cloudanton NON-SPRING-BOOT project, please follow:- copy example
cp src/test/resources/test-context.xml.example src/test/resources/test-context.yml - fill correct account info in the file
application.ymlon test Make a Cloudant account and create a test-context.xml file(path /src/test/java/resources/) with the following content:
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:repository="http://www.springframework.org/schema/data/repository" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation="http://www.springframework.org/schema/data/repository http://www.springframework.org/schema/data/repository/spring-repository http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> <context:component-scan base-package="org.springframework.data.cloudant"> </context:component-scan> <bean id="connectOptions" class="com.cloudant.client.api.model.ConnectOptions"> <property name="connectionTimeout" value="6000"/> <property name="maxConnections" value="10"/> </bean> <bean id="cloudantClient" class="com.cloudant.client.api.CloudantClient"> <constructor-arg index="0" value="YOUR_ACCOUNT_HERE"/> <constructor-arg index="1" value="YOUR_USERNAME_HERE"/> <constructor-arg index="2" value="YOUR_PASSWORD_HERE"/> <constructor-arg index="3" ref="connectOptions"/> </bean> <bean id="cloudantTemplate" class="org.springframework.data.cloudant.core.CloudantTemplate"> <constructor-arg index="0" ref="cloudantClient"/> <constructor-arg index="1" value="YOUR_DATABASE_HERE"/> </bean> </beans>
- copy example
-
Setting projects in Spring-boot
- copy example
cp src/test/resources/application.yml.example src/test/resources/application.yml - fill correct account info in the file
application.ymlon test Make a Cloudant account and create a test-context.xml file(path /src/test/java/resources/) with the following content:
cloudant:
connectionTimeout: 2000
maxConnections: 100
url: YOUR_ACCOUNT_URL
accountName: ACCOUNT_NAME
username: API_KEY
password: API_password
db: CLOUDANT_DB_NAME