hzpz/mongeez-spring-boot-starter

No support for mongodb URI property

robmoore opened this issue · 4 comments

Maybe I don't understand how MongeezProperties works but it looks like it doesn't pick up the URI value used in setting the application properties (spring:data:mongodb:uri). Also, MongeezProperties does not have a uri property. Is there a reason for this or has it just not been implemented yet. If the latter, I'd take a stab at coding something up if you provide a little direction.

One reason this could be beneficial is that if you are using an SSL connection, you can pass in ssl=true in the uri whereas it's more involved otherwise.

hzpz commented

You are right, there is no URI support in MongeezProperties. That is because Mongeez itself does not support URIs. You will have to implement it in Mongeez first before this starter can support URIs.

@hzpz Thanks for the response. It does look like it's possible to use a URI according to the Mongeez docs. It seems like it might be possible to have MongeezProperties autowired in such a way that it would pick up the URI and create the MongoURI object on its own?

hzpz commented

The URI in the example you linked is used to create an instance of Mongo. You can do the same by setting spring.data.mongodb.uri (or using MongoProperties directly) as you already pointed out. However, take a look a the constructor of MongeezDao (https://github.com/mongeez/mongeez/blob/master/src/main/java/org/mongeez/dao/MongeezDao.java) to see what they (the Mongeez guys) are actually doing with this Mongo instance: they call getServerAddressList() which seems to ignore any URI parameters.

@hzpz Thanks for the explanation. I've opened a ticket for adding support in Mongeez.