配置application.yml踩的坑

spring:
  application:
    name: user-center
    datasource:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://localhost:3306/scheduling
      username: root
      password: 123456

server:
  port: 8080

mybatis-plus:
  configuration:
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
    map-underscore-to-camel-case: true

更改后

spring:
  application:
    name: user-center
  # DataSource Config
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/usercenter
    username: root
    password: 123456
server:
  port: 8080
mybatis-plus:
  configuration:
    map-underscore-to-camel-case: false

配置的时候,错将datasource放在了application的下一级,所以运行时,检测不出datasource下配置的所有东西。(我找了很长时间的报错,没想到就出现在这个很小的细节上,警钟长鸣)

posted @ 2023-08-24 11:32  万事胜意k  阅读(26)  评论(0编辑  收藏  举报