久久久久久AV无码免费看大片,亚洲一区精品人人爽人人躁,国产成人片无码免费爱线观看,亚洲AV成人无码精品网站,为什么晚上搞的时候要盖被子

初步搭建springboot應(yīng)用,報錯:Failed to configure a DataSour

時間:2020-06-29 10:31:01 類型:JAVA
字號:    

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

  翻譯就是:無法配置DataSource:未指定'url'屬性,也無法配置嵌入數(shù)據(jù)源。

  總之意思就是你在應(yīng)用中沒有配置datasource的一些相關(guān)屬性,例如:地址值啊,數(shù)據(jù)庫驅(qū)動啊,用戶名啊,密碼之類的

  SpringBoot的最大一個好處就是自動配置:所以我們只是需要給他配置文件的值,它就會自動配置。配置在application.properties文件中

  那么我將把SpringBoot的一些最基本的配置信息給大家站出來:

#訪問根路徑

#應(yīng)用名稱
spring.application.name=springboot-demo

#訪問端口號
server.port=80

#編碼格式
server.tomcat.uri-encoding=utf-8

#數(shù)據(jù)庫相關(guān)配置
#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver # MySQL8.0
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/stu_info
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.max-idle=10
spring.datasource.max-wait=10000
spring.datasource.min-idle=5
spring.datasource.initial-size=5

#session生命周期
server.servlet.session.timeout=30m

  當然,也可以不配置,但是你需要聲明一下

  啟動類頭部聲明就可以了:


  @SpringBootApplication(exclude= {DataSourceAutoConfiguration.class})


<