예제 #1
0
  private CouchDbConnector getCouch() throws IOException {
    final HttpClient httpClient = new StdHttpClient.Builder().url("http://localhost:5984").build();

    final CouchDbInstance dbInstance = new StdCouchDbInstance(httpClient);
    final CouchDbConnector db = new StdCouchDbConnector("hybriddb", dbInstance);
    db.createDatabaseIfNotExists();
    return db;
  }
 @Bean
 public CouchDbConnector createConnector() throws MalformedURLException {
   HttpClient httpClient =
       new StdHttpClient.Builder()
           .url(couchDBConfig.getUrl())
           .username(couchDBConfig.getUser())
           .password(couchDBConfig.getPassword())
           .build();
   CouchDbInstance couchDbInstance = new StdCouchDbInstance(httpClient);
   CouchDbConnector connector =
       new StdCouchDbConnector(couchDBConfig.getDataBase(), couchDbInstance);
   connector.createDatabaseIfNotExists();
   return connector;
 }