Spring Cloud问题分析

本文介绍了在基于SpringCloud框架开发过程中遇到问题时的定位思路,主要包括配置问题排查、环境问题排查及代码问题排查等方面。

  基于Spring Cloud框架开发时,经常会碰到各种开发问题,那么碰到这些问题时如何去解决呢?下面描述基于Spring Cloud问题定位的基本思路,大概可以分为如下几步:

  • 排查配置问题
  • 环境问题
  • 排查代码问题
  • 定位Spring-Cloud Bug

一、配置问题

   (1)配置属性错误

   配置属性错误包括:A.配置拼写错误;B.yaml缩进错误(yaml缩进错误可能会导致配置解析失败,甚至启动失败);

   (2)配置位置错误

    应写在bootstrap.yml中的配置写在了application.yml中

  • bootstrap.yml is loaded before application.yml
  • It is typically used for the following:
  1. when using Spring Cloud Config Server, you should specify spring.application.name and spring.cloud.config.server.git.uri inside bootstrap.yml
  2. some encryption/decryption information

    Technically, bootstrap.yml is loaded by a parent Spring ApplicationContext. That parent ApplicationContext is loaded before the one that uses application.yml

 参考:https://stackoverflow.com/questions/32997352/what-is-the-diference-between-putting-a-property-on-application-yml-or-bootstrap  

            https://stackoverflow.com/questions/37074642/settings-in-application-yml-for-spring-cloud-config-arent-used-when-app-is-exec

            https://juejin.im/entry/585788e1b123db00658219bd

二、环境问题

  (1)JAVA环境变量

  (2)Maven环境变更

  (3)Spring Boot/Spring Cloud环境变量

 (4)Spring Boot/Spring Cloud允许使用环境变量加载配置

三、Spring Cloud Bug

   如:spring-boot 自定义内置tomcat信息泄漏问题,参见:https://my.oschina.net/u/252181/blog/832562

转载于:https://www.cnblogs.com/moonandstar08/p/7512409.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值