This is connection string I have recieved from Atlas UI : mongodb+srv://:@work.b83isih.mongodb.net/?retryWrites=true&w=majority&appName=work
Then i pasted this string in → spring.data.mongodb.uri = connection string
where i replaced my username and password. Other than this property , only 2 other properties are specified in my application.properties :
spring.data.mongodb.database = journaldb
spring.data.mongodb.auto-index-creation = true
On running it gives me a long list of errros mainly because it couldn’t establish connection with mongodb atlas. Here is how the errror starts :
2024-07-01T01:58:37.670+05:30 INFO 3172 --- [Project] [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port 8080 (http)
2024-07-01T01:58:37.682+05:30 INFO 3172 --- [Project] [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2024-07-01T01:58:37.682+05:30 INFO 3172 --- [Project] [ main] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.1.25]
2024-07-01T01:58:37.746+05:30 INFO 3172 --- [Project] [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2024-07-01T01:58:37.747+05:30 INFO 3172 --- [Project] [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1216 ms
2024-07-01T01:58:52.978+05:30 WARN 3172 --- [Project] [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'journalEntryController': Unsatisfied dependency expressed through field 'journalEntryService': Error creating bean with name 'journalEntryService': Unsatisfied dependency expressed through field 'journalEntryRepository': Error creating bean with name 'journalEntryRepository' defined in com.springSecurity.Project.repository.JournalEntryRepository defined in @EnableMongoRepositories declared on MongoRepositoriesRegistrar.EnableMongoRepositoriesConfiguration: Cannot resolve reference to bean 'mongoTemplate' while setting bean property 'mongoOperations'
2024-07-01T01:58:52.982+05:30 INFO 3172 --- [Project] [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2024-07-01T01:58:52.992+05:30 INFO 3172 --- [Project] [ main] .s.b.a.l.ConditionEvaluationReportLogger :
Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.