We Are Going To Discuss About Failed to auto-configure a DataSource: ‘spring.datasource.url’ is not specified. So lets Start this Java Article.
Failed to auto-configure a DataSource: ‘spring.datasource.url’ is not specified
- Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified
Since you have added both mongodb and data-jpa dependencies in your pom.xml file, it was creating a dependency conflict like below
<dependency>
- Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified
Since you have added both mongodb and data-jpa dependencies in your pom.xml file, it was creating a dependency conflict like below
<dependency>
Solution 1
Since you have added both mongodb and data-jpa dependencies in your pom.xml file, it was creating a dependency conflict like below
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
Try removing jpa dependency and run. It should work fine.
Original Author Bhabadyuti Of This Content
Solution 2
Go to resources folder where the application.properties is present, update the below code in that.
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
Original Author pushpendra yadav Of This Content
Solution 3
Add the line below in application.properties file under resource folder and restart your application.
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
Original Author bikram sahoo Of This Content
Solution 4
Seems there is missing MongoDB driver. Include the following dependency to pom.xml
:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
Original Author Nikolas Charalambidis Of This Content
Conclusion
So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.