配置服务器 - 应用程序服务设置

  • 以下是application.yml的配置
server:
  port: 8882
eureka:
  client:
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/
spring:
  cloud:
    config:
      server:
         git:uri: https://github.com/appleman/config
  • 以下是boostrap.yml的配置
spring:
  application:
    name: configserver
  • 这个普通的 Spring 季启动应用程序的启动将config-server注册到Eureka .

**通用Eureka Server正在8761端口上运行

***以下是应用程序客户端配置

  • 以下是我的bootstrap.yml中的Application Client配置
spring:
  application:
    name: contractService,envDEV13 
  cloud:
    config:
    enabled: true
    discovery:
     enabled: true
     serviceId: configserver
eureka:
  instance:
    nonSecurePort: ${server.port:8080}
  client:
    serviceUrl:
      defaultZone: http://${eureka.host:localhost}:${eureka.port:8761}/eureka/
  • 在Spring Controller中注入属性,如下面的代码段不起作用 .
@Value("${creditService.eppDbUrl}")
String bar;

如果我们做错了,请建议我们 .