0

I am trying to create a Restful API using Springboot but am running into the following error:

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

Reason: Failed to determine a suitable driver class

Here is my Pom.xl

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.6.7</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.enterpriseproj</groupId>
    <artifactId>filmdepo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>griffin</name>


    <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>1.8</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                
            </plugin>
        </plugins>
    </build>

</project>

My Application properties (I don't wan't to show all the details as they show personal info.) :

spring.datasource.url= 
spring.datasource.username=
spring.datasource.password=
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
BateauG
  • 1
  • 2
  • did you tried adding: spring.datasource.driver-class-name=com.mysql.jdbc.Driver – Cayman Apr 26 '22 at 23:41
  • I did, no luck. – BateauG Apr 26 '22 at 23:44
  • 1
    If that is what is in your `application.properties` there really is no url property. If there is there is something wrong which you aren't explaining (like trying to be smarter then your build system, putting files in the wrong location etc.). – M. Deinum Apr 27 '22 at 07:28

0 Answers0