I am working on a Spring Boot Batch example with MongoDB and I have already started the mongod
server.
When I launch my application, I
If you added "spring-boot-starter-data-jpa" dependency in pom.xml, Please add respective database in dependency like h2 and etc.
For me the resource folder was getting excluded on a maven update/build. I went to Build Path>Source and found that src/main/resources have "Excluded **". I removed that entry (Clicked on Excluded **>Remove>Apply and Close).
Then it worked fine.
Excluding the DataSourceAutoConfiguration.class
worked for me:
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class })
If datasource is defined in application.resources
, make sure it is locate right under src/main
and add it to the build path.
I meet same error when start a new project. Use command line works for me.
./gradlew bootRun
“Failed to configure a DataSource” error. First, we fixed the issue by defining the data source. Next, we discussed how to work around the issue without configuring the data source at all.
https://www.baeldung.com/spring-boot-failed-to-configure-data-source