日韩精品欧美激情国产一区_中文无码精品一区二区三区在线_岛国毛片AV在线无码不卡_亞洲歐美日韓精品在線_使劲操好爽好粗视频在线播放_日韩一区欧美二区_八戒八戒网影院在线观看神马_亚洲怡红院在线色网_av无码不卡亚洲电影_国产麻豆媒体MDX

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

時(shí)間:2020-06-29 10:31:01 類(lèi)型:JAVA
字號(hào):    

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

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

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

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

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

#訪問(wèn)根路徑

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

#訪問(wèn)端口號(hào)
server.port=80

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

#數(shù)據(jù)庫(kù)相關(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

  當(dāng)然,也可以不配置,但是你需要聲明一下

  啟動(dòng)類(lèi)頭部聲明就可以了:


  @SpringBootApplication(exclude= {DataSourceAutoConfiguration.class})


<