'Spring boot and JPA - javax.persistence.spi::No valid providers found

I am using Spring Boot for my application and try to access an MS SQL database through JPA. But I am getting an error javax.persistence.spi::No valid providers found.

I added the necessary libs in dependencies:

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-autoconfigure-processor</artifactId>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-jpa</artifactId>
        <!--<version>2.4.13</version>-->
    </dependency>
    <dependency>
        <groupId>javax.persistence</groupId>
        <artifactId>javax.persistence-api</artifactId>
        <version>2.2</version>
    </dependency>
    <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
    </dependency>

And I also used configuration in application.yaml

spring:
  datasource:
    url: jdbc:sqlserver://DEV\SQLLOKAL;databaseName=myDB
    username: myDBUser
    password: myDBPass
  jpa:
    properties:
      hibernate:
        dialect: org.hibernate.dialect.SQLServerDialect
    hibernate:
  ddl-auto: validate
show-sql: true

Is there any kind of more configuration missing? Or more dependencies?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source