1

我有多模块 Spring Boot 应用程序。对于 UserManager 模块,我有 userman.yml、userman-development.yml 以及资源部分中的 bootsrap.yml。但是,我无法访问 userman-dev.yml。我在 userman-development.yml 中设置了数据库 url,因为它没有看到我得到的 userman-development.yml

我得到的错误

Description:

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

Reason: Failed to determine a suitable driver class


Action:

Consider the following:
    If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
    If you have database settings to be loaded from a particular profile you may need to activate it (the profiles development are currently active).

这是

引导带.yml

eureka:
  instance:
    leaseRenewalIntervalInSeconds: 3
    leaseExpirationDurationInSeconds: 4
  client:
    registryFetchIntervalSeconds: 1
    initialInstanceInfoReplicationIntervalSeconds: 4
flyway:
  enabled: false
spring:
  application:
    name: usermanager
    tomcat-timeout-minutes: 3
     
  cloud:
    config:
      uri: ${vcap.services.eureka-service.credentials.uri:http://127.0.0.1:8761}/config
      failFast: true
      retry:
        initialInterval: 2000
        multiplier: 1.5
        maxInterval: 4000
        maxAttempts: 30

server:
  port: 9100

endpoints:
  info:
    enabled: true

用户开发.yml

spring:
   datasource:
      url: "jdbc:postgresql://localhost/`BUSDRIVERS"
      username: postgres
      password: 1
logging:
   level:
      com.iozer.example: DEBUG
      com.netflix.discovery.TimedSupervisorTask: "OFF"
dev:
   adminEnabled: true

如何解决这个问题?我在这部分缺少什么?我的逻辑正确吗?

谢谢你..

4

1 回答 1

0

the profiles development are currently active- 通常,活动配置文件development将插入如下内容:application-{ENV}.yaml- 因此您可能需要application-development.yaml或将配置文件名称更新为dev.

于 2020-06-11T08:57:17.980 回答