Failed to configure Datasource on spring data jpa dependency?

Viewed 49

I have a client application with a class that uses Specification, therefore I need a spring data jpa dependency. I know that the Boot dependency:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

...throws an error (Failed to configure a Datasource...) at startup if you include the dependency without a Datasource configured. However, I still get the error when I use this dependency (so just Spring, no Boot) when I import my client in a Spring Boot application when the client uses this dependency:

<dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-jpa</artifactId>
</dependency>

Why do I still get this error? I know I can suppress the warning with a property (exclude DataSourceAutoConfiguration) or annotation, but I would prefer not to, and don't really understand why I get this error from Spring. In my understanding, Boot is opiniated throws this error to inform me of missing config, but I thought the vanilla Spring dependency would not do this. I can't find any info on expected behavior on the non-starter dependency, just on the starter dependency.

1 Answers

In spring boot 2.7.3 I didn't find this problem.

Related