chenweida 8 anni fa
parent
commit
2563208ead

+ 0 - 2
svr-configuration/src/main/resources/bootstrap.yml

@ -16,8 +16,6 @@ spring:
          uri: http://192.168.1.220:10080/chenweida/jw.config.git
        default-label: master
---
spring:
  profiles: test

+ 25 - 0
svr/svr-base/src/main/java/com/yihu/jw/hospital/controller/TestController.java

@ -0,0 +1,25 @@
package com.yihu.jw.hospital.controller;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * Created by chenweida on 2017/5/15.
 */
@Api("测试")
@RestController
@RequestMapping("/test")
public class TestController {
    @Value("${testvalue}")
    private String value;
    @GetMapping("value")
    public String getValue(){
        return value;
    }
}

+ 14 - 1
svr/svr-base/src/main/resources/application.yml

@ -1,4 +1,4 @@
##如果有配置服务的话,远程服务器和本地服务器配置不一致的情况下,优先远程的为主
##如果有配置服务的话,远程服务器和本地服务器配置不一致的情况下,优先远程的为主  git上 svr-base ->  git application ->本地 appliction ->本地 bootstarp
server:
  port: 10020
@ -6,6 +6,18 @@ spring:
  application:
    name:  svr-base  ##注册到发现服务的id 如果id一样 eurika会自动做负载
eureka:
  client:
    healthcheck:
      enabled: true #启动监控检查
  instance:
    #eurika使用IP不使用host
    prefer-ip-address: true
    #定制化在eurika中显示的名称
    instance-id: ${spring.application.name}:${spring.application.instance_id:${server.port}}
---
spring:
  profiles: dev
@ -18,3 +30,4 @@ spring:
---
spring:
  profiles: prod

+ 1 - 13
svr/svr-base/src/main/resources/bootstrap.yml

@ -1,27 +1,15 @@
##优先读取 boostarap配置 然后在读取application。yml的配置
spring:
  application:
    name: svr-user
  #从发现服务里面取配置服务的信息
  cloud:
    config:
      username: jw
      password: jkzl
      discovery:
        enabled: true ##开始发现服务
        enabled: true ##使用发现服务
        service-id: svr-configurations ##配置服务的名字
eureka:
  client:
    healthcheck:
      enabled: true #启动监控检查
  instance:
    #eurika使用IP不使用host
    prefer-ip-address: true
    #定制化在eurika中显示的名称
    instance-id: ${spring.application.name}:${spring.application.instance_id:${server.port}}
---
spring:
  profiles: dev