springboot初始搭建后编译报错

Failed to configure a DataSource: 'url' attribute is not specified .....
原因是项目中引用了数据库的相关依赖(例如mybatis,tkmapper等),但是没有配置数据库连接。
最简单的解决办法:

在application.propertie或application.yml文件中添加数据库配置:

server:
  port: XXXX
spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/springboot-vue?serverTimezone=GMT%2b8&useUnicode=true&characterEncoding=UTF-8
    username: root
    password: XXXX


 

猜你喜欢

转载自blog.csdn.net/wangluoxiehui/article/details/125658137