3 回答

TA貢獻(xiàn)1824條經(jīng)驗(yàn) 獲得超8個(gè)贊
因此,經(jīng)過深思熟慮,我決定查看一下我的資源文件夾和 application.properties 文件,結(jié)果發(fā)現(xiàn)資源目錄沒有標(biāo)記為資源根目錄,右鍵單擊資源文件夾目錄,將鼠標(biāo)懸停在“標(biāo)記目錄”上as并選擇資源根?
抱歉浪費(fèi)了大家的時(shí)間,感謝您的所有幫助,因?yàn)槲掖_實(shí)使用了提到的一些配置

TA貢獻(xiàn)1799條經(jīng)驗(yàn) 獲得超6個(gè)贊
看起來像依賴性問題嘗試指定驅(qū)動(dòng)程序的版本:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.17</version>
</dependency>

TA貢獻(xiàn)1818條經(jīng)驗(yàn) 獲得超8個(gè)贊
您好,在您的財(cái)產(chǎn)文件上設(shè)置:
spring.datasource.url=jdbc:mysql://localhost:3306/invoice
spring.datasource.username=root
spring.datasource.password=password
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
在你的 pom.xml 上
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.7.RELEASE</version>
<relativePath/>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<!-- ... -->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>yourpackage.YourInitialApp</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
添加回答
舉報(bào)