Spring 云配置不应用全局配置

Spring cloud config not apply global configuration

我在 spring 云配置 2020.0.3 上遇到问题,spring 启动 2.4.5 以获取详细信息:

my_cofig.yaml

spring:
  datasource:
    url: "jdbc:mariadb://localhost:3306/default_db"
    driver-class-name: org.mariadb.jdbc.Driver
    username: my_db
    password: 12345
---
spring:
  profiles: dev
  datasource:
    url: "jdbc:mariadb://localhost:3306/dev_db"

bootstrap.yaml

server:
  port: 8081
spring:
  application:
    name: auth-service
  cloud:
    config:
      enabled: true
      fail-fast: true
      allow-override: true
      profile: dev
      uri: http://localhost:5000

错误详情:

Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set

请帮助我,非常感谢!

spring:
  profiles:

这不存在(如果我没记错的话,它已被弃用)。请检查 reference documentation.

我相信您正在寻找的是以下内容(reference documentation):

spring:
  datasource:
    url: "jdbc:mariadb://localhost:3306/default_db"
    driver-class-name: org.mariadb.jdbc.Driver
    username: my_db
    password: 12345
---
spring:
  config:
    activate:
      on-profile: dev
  datasource:
    url: "jdbc:mariadb://localhost:3306/dev_db"

最后我把spring引导版本升级到2.5.1解决了问题 谢谢大家