Craig Raw
2014-05-28 10:20:47 UTC
Hi,
I have been chatting to Ben Hale, one of the Cloud Foundry Java buildpack
developers, and it seems that autoconfiguration no longer works when
deploying a Grails app with the mongodb plugin to Cloud Foundry.
For autoconfiguration to work, CF looks for a bean in the application
context of type org.springframework.data.mongodb.MongoDbFactory, and
reconfigures that with the configuration details of the CF provided mongo
instance. However, the Grails mongodb plugin doesn't use/expose this bean
(although it does use the spring-data-mongodb library from which it comes),
so autoconfiguration does not occur.
The workaround is using the spring-cloud jars and adding some code to
DataSource.groovy to explicitly fetch the mongo configuration details from
the cloud and set them appropriately. This works, although it's arguably
not ideal for all circumstances.
I'd like to ask whether it's possible to expose
org.springframework.data.mongodb.MongoDbFactory in some way to make
autoconfiguration possible, or failing that some direction on the
appropriate starting point to help the CF guys get Grails+MongoDB
autoconfiguration working again.
Thanks,
Craig
(Conversation on CF forum here:
https://groups.google.com/a/cloudfoundry.org/forum/#!topic/vcap-dev/ixuMoCT2tlM
)
I have been chatting to Ben Hale, one of the Cloud Foundry Java buildpack
developers, and it seems that autoconfiguration no longer works when
deploying a Grails app with the mongodb plugin to Cloud Foundry.
For autoconfiguration to work, CF looks for a bean in the application
context of type org.springframework.data.mongodb.MongoDbFactory, and
reconfigures that with the configuration details of the CF provided mongo
instance. However, the Grails mongodb plugin doesn't use/expose this bean
(although it does use the spring-data-mongodb library from which it comes),
so autoconfiguration does not occur.
The workaround is using the spring-cloud jars and adding some code to
DataSource.groovy to explicitly fetch the mongo configuration details from
the cloud and set them appropriately. This works, although it's arguably
not ideal for all circumstances.
I'd like to ask whether it's possible to expose
org.springframework.data.mongodb.MongoDbFactory in some way to make
autoconfiguration possible, or failing that some direction on the
appropriate starting point to help the CF guys get Grails+MongoDB
autoconfiguration working again.
Thanks,
Craig
(Conversation on CF forum here:
https://groups.google.com/a/cloudfoundry.org/forum/#!topic/vcap-dev/ixuMoCT2tlM
)
--
**********************************************************************
Please read our *email disclaimer*<http://www.quirk.biz/downloads/legal/Quirk_Email_Disclaimer.pdf>.
It sets out our position on the content, integrity and security of this
*confidential *email and explains what to do if you have received it in
error.
**********************************************************************
**********************************************************************
Please read our *email disclaimer*<http://www.quirk.biz/downloads/legal/Quirk_Email_Disclaimer.pdf>.
It sets out our position on the content, integrity and security of this
*confidential *email and explains what to do if you have received it in
error.
**********************************************************************