# SpringCloud_Demo **Repository Path**: olywa/SpringCloud_Demo ## Basic Information - **Project Name**: SpringCloud_Demo - **Description**: spring cloud上手测试 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2018-09-27 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # SpringCloud_Demo #### 项目介绍 spring cloud上手测试 #### 软件架构 软件架构说明 spring cloud相关框架测试 #### 安装教程 1. xxxx 2. xxxx 3. xxxx #### 使用说明 1. xxxx 2. xxxx 3. xxxx #### 参与贡献 1. Fork 本项目 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request 异常记录: 1. spring boot 2.0.0.RELEASE必须与cloud的Finchley.SR1(及以上版本搭配使用)否则报错: java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder.([Ljava 2. 若没有使用数据源则需要在主启动类加注解时加入exclude如:@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}) 否则报错: Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified and no embedded datasource could be auto-configured. 3. Parameter 0 of constructor in com.tao.springcloud.cfgbeans.ConfigBeans required a bean of type 'org.springframework.web.client.RestTemplate' that could not be found. 4. 配置eureka集群时,hostname中不能有下划线 否则出现一下异常 o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is freemarker.core.InvalidReferenceException: The following has evaluated to null or missing: ==> replica.key [in template "eureka/navbar.ftl" at line 68, column 62] 5. spring cloud2 hystrix没有/actuator/hystrix.stream路径:需要在启动类添加servlet代码才能查看详见spring-cloud-server-hystrix启动类 IDEA操作记录: 1.热部署: 只需要添加devtools依赖即可 org.springframework.boot spring-boot-devtools true true JVM会定时扫描重新加载且仅加载有改动的类文件(.class文件),而不是加载所有的类文件,大大减少了类加载耗费的时间,从而实现热部署的功能。 Eclipse默认自动编译,而idea默认手动编译,因此idea需要修改两个参数以达到任意时间自动编译的目的。 首先,File->setting->搜索compiler->将Build project automatically打勾(yml可能需要在上面添加支持) (注意后面only works not running/debugging,所以我们要实现热部署就必须打破这个限制,于是乎有了下面设置) 然后,CTRL+ALT+SHIFT+/ 组合键打开 Maintenance窗口选择Registry... ,找到compiler.automake.allow.when.app.running选项,打勾开启运行时编译功能(找了半天才发现是按字母排序的) 2. 安装spring Assistant可以辅助填充yml 思考: 1.spring-cloud-server在项目中可以看到是包含有3个module(server01/server02/server03),3个最大的区别在于数据源不同(代码相同),3个组合在一起类似于集群服务;在实际运用中应该是一套代码部署3套, 而不是像现在这样,或者本案例只是通过3个module模拟集群;(eureka集群也有类似问题) ####### hystrix: http://localhost:3083/hystrix #### 码云特技 1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md 2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com) 3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目 4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目 5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) 6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)