SpringCloud中的application.yml或者application.property文件

application.property文件方式和application.yml方式配置文件方式对比

一个是一字长蛇阵的配置,一个是这样分开的配置

注意:

分开的配置是有讲究的:

1.不同的等级之间用冒号隔开

2.次等级前面是空格不能用tab符

3.每一层的冒号后面如果有值,要用空格符号分开

 

 

这个配置文件中的一些具体的配置的用法:

spring:
    mvc:
        view:
            prefix: /WEB-INF/jsp/
            suffix: .jsp
server:
    port: 8888
    context-path: /test

对于git的一些注解:

   spring.cloud.config.server.git.uri=https://github.com/how2j/trendConfig/     //配置git的仓库地址

 spring.cloud.config.server.git.searchPaths=respo  //表示目录

spring.cloud.config.server.default-label=master // 默认仓库的分支

在趋势投资项目的访问git是这样配置的

spring:
  application:
    name: index-config-server
  cloud:
    config:
      label: master
      server:
        git:
          uri: https://github.com/how2j/trendConfig/
          searchPaths: respo
eureka:
  client:
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/

最后访问的是这个

https://github.com/how2j/trendConfig/blob/master/respo/trend-trading-backtest-view-dev.properties

 

 

 

 

 

 

 

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值