'Not able to establish connection between mongodb and Springboot through app.properties file
I want to establish connection with mongodb through app.properties files in Spring boot. Currently, I am establishing connection through Uri variable declared in the class file itself.
private static String uri ="mongodb://localhost:27017/?readPreference=primary&appname=MongoDB%20Compass&directConnection=true&ssl=false";
private static String database = "xyz";
When I am trying to configure it in app.properties files like this
spring.data.mongodb.uri= mongodb://localhost:27017/?readPreference=primary&appname=MongoDB%20Compass&directConnection=true&ssl=false
spring.data.mongodb.database = xyz
It is not connecting and I am getting this error
Cannot invoke "String.startsWith(String)" because "connectionString" is null
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
