[Solved] Failed to configure a DataSource: ‘url’ attribute is not specified and no embedded datasource could be configured.

In the spring boot project, I deleted a line of code because I was in debt. It took 2-3 hours to solve the problem. It is hereby recorded.

        <!--The following resources are added later to specify the package file -->
         <resources>
             <resource>
                 <directory>src/main/resources</directory>
                 <!-- The resource root directory excludes the configuration of each environment to prevent redundant directories in the generated directory -->
                <filtering>true</filtering>
                <excludes>
                    <exclude>application*.yml</exclude>
                </excludes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>application.yml</include>
                    <include>application-${profiles.active}.yml</include>
                </includes>
            </resource>
        </resources>

This <include> in application.yml It was deleted by me.

Similar Posts: