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

今天在打jar包的时候报这个问题,有时候又不报,到底是什么原因呢?

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

原因是:pom.xml没有正确加载资源,因为之前将mybatis的xml文件转移到了src/main/java目录下,pom.xml未配置完整,可能导致打jar包的时候,程序无法扫描到src/main/resource目录下某些yml文件的某些配置。于是,把pom.xml贴出来:

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <!--允许第三方jar包打入项目包中-->
            <configuration>
                <includeSystemScope>true</includeSystemScope>
            </configuration>
        </plugin>
    </plugins>
    <finalName>xxxxx</finalName>
    <resources>
        <resource>
            <directory>src/main/java</directory>
        </resource>
        <resource>
            <directory>src/main/resources</directory>
        </resource>
    </resources>
</build>

 


132 Clicks !

发表评论

电子邮件地址不会被公开。