Using lazily the Erktop connection to CouchDB

69 views
Skip to first unread message

nestor.urquiza

unread,
Oct 17, 2011, 12:36:19 AM10/17/11
to ektorp-discuss
Hi,

I have integrated Erktop in our existing Spring application. If I
follow the suggestions from tutorial and sample code my Spring
application will fail to start if the CouchDB server is not listening
for connections. Is there a way to allow the application to continue
and just fail in the case the Repository is invoked?

Here is the typical error:

Caused by: org.springframework.beans.BeanInstantiationException: Could
not instantiate bean class
[com.nestorurquiza.dms.couchdb.erktop.dao.DocumentRepository]:
Constructor threw exception; nested exception is
org.ektorp.DbAccessException:
org.apache.http.conn.HttpHostConnectException: Connection to
http://localhost:5984 refused

Thanks!
-Nestor

Henrik Lundgren

unread,
Oct 17, 2011, 3:05:24 AM10/17/11
to ektorp-...@googlegroups.com
I think you will have to implement a custom bean factory that creates
a proxy for your repository that will defer the creattion of your
actual repo until the first call.

/Henrik

Reply all
Reply to author
Forward
0 new messages