简体   繁体   中英

How to give external .yml file in Spring Boot Eureka Config?

I have multi-module Spring Boot Application. For the UserManager module I have userman.yml, userman-development.yml and also I have bootsrap.yml in resources part. However, I could not reach the userman-dev.yml. I set up the database url in userman-development.yml, as it does not see the userman-development.yml I am getting

Error I Get

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).

Here is

BootStrap.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

userman-development.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

How can Solve this? What I am missing in this part? Is my logic correct?

Thank You..

the profiles development are currently active - typically, the active profile development will be interpolated into something like: application-{ENV}.yaml - so you may need application-development.yaml or to update the profile name to dev .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM