一 前言

几大RPC框架介绍

1.支持多语言的RPC框架,google的gRPC,Apache(facebook)的Thrift
2.只支持特定语言的RPC框架,例如新浪的Motan
3.支持服务治理等服务化特性的分布式框架,例如阿里的dubbo
4.拥有完整生态的spring cloud
 

spring cloud远程调用方式---Feign

Feign是一个声明似的web服务客户端,它使得编写web服务客户端变得更加容易。使用Fegin创建一个接口并对它进行注解。它具有可插拔的注解支持包括Feign注解与JAX-RS注解,Feign还支持可插拔的编码器与解码器,Spring Cloud 增加了对 Spring MVC的注解,Spring Web 默认使用了HttpMessageConverters, Spring Cloud 集成 Ribbon 和 Eureka 提供的负载均衡的HTTP客户端 Feign。

Feign提供了HTTP请求的模板,通过编写简单的接口和插入注解,就可以定义好HTTP请求的参数、格式、地址等信息。而Feign则会完全代理HTTP请求,我们只需要像调用方法一样调用它就可以完成服务请求及相关处理。SpringCloud对Feign进行了封装,使其支持SpringMVC标准注解和HttpMessageConverters。Feign可以与Eureka和Ribbon组合使用以支持负载均衡。

官方解释: Feign is a Java to HTTP client binder inspired by RetrofitJAXRS-2.0, and WebSocket. Feign's first goal was reducing the complexity of binding Denominator uniformly to HTTP APIs regardless of ReSTfulness.

Feign的两种调用方式

1 直接在调用者声明Feign客户端

如下图所示, service-b 声明一个接口, 去调用路径为 /user/get 的服务 service-a 的服务

2 在被调用者接口Api中声明Feign客户端

如下图, 在被调用者中声明接口, 去调用自己, 这种方法遵循面向接口编程, 而且使用起来, 就类似dubbo一样, @Autowire直接注入就可以使用了.

以上可能看得读者一头雾水, 以下具体的代码流程, 可以方便更加具体的了解

二 案例1直接在调用者声明Feign客户端代码实现

以下步骤为手把手教学, 请明白我的良苦用心

步骤0 创建一个SpringCloud-Eureka注册中心

首先创建一个父项目

把其他都删除, 剩下pom文件

以下为父项目的依赖

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  4. <modelVersion>4.0.0</modelVersion>
  5.  
  6. <groupId>com.fegin</groupId>
  7. <artifactId>test</artifactId>
  8. <version>0.0.1-SNAPSHOT</version>
  9.  
  10. <packaging>pom</packaging>
  11.  
  12. <!--springboot version 2.1.4-->
  13. <parent>
  14. <groupId>org.springframework.boot</groupId>
  15. <artifactId>spring-boot-starter-parent</artifactId>
  16. <version>2.1.4.RELEASE</version>
  17. <relativePath/> <!-- lookup parent from repository -->
  18. </parent>
  19.  
  20. <properties>
  21. <java.version>1.8</java.version>
  22. <spring-cloud.version>Greenwich.SR1</spring-cloud.version>
  23. </properties>
  24.  
  25. <!--springcloud version Greenwish.SR1-->
  26. <dependencyManagement>
  27. <dependencies>
  28. <dependency>
  29. <groupId>org.springframework.cloud</groupId>
  30. <artifactId>spring-cloud-dependencies</artifactId>
  31. <version>${spring-cloud.version}</version>
  32. <type>pom</type>
  33. <scope>import</scope>
  34. </dependency>
  35. </dependencies>
  36. </dependencyManagement>
  37.  
  38. </project>

创建eureka项目

项目结构如图

添加eureka的依赖

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5. <parent>
  6. <artifactId>test</artifactId>
  7. <groupId>com.fegin</groupId>
  8. <version>0.0.1-SNAPSHOT</version>
  9. </parent>
  10. <modelVersion>4.0.0</modelVersion>
  11.  
  12. <artifactId>eureka</artifactId>
  13.  
  14. <!--eureka服务端配置-->
  15. <dependencies>
  16. <dependency>
  17. <groupId>org.springframework.cloud</groupId>
  18. <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
  19. </dependency>
  20. </dependencies>
  21. </project>

添加application.yml

  1. server:
  2. port: 8761
  3.  
  4. eureka:
  5. instance:
  6. hostname: localhost
  7. client:
  8. # 是否把自己作为服务注册到其他服务注册中心
  9. registerWithEureka: false
  10. # 是否从其他的服务中心同步服务列表
  11. fetchRegistry: false
  12. serviceUrl:
  13. defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
  14. server:
  15. # 关闭保护机制,默认true
  16. enable-self-preservation: false
  17. # 剔除失效服务间隔,默认60000
  18. eviction-interval-timer-in-ms: 3000

添加启动类代码EurekaApplication

  1. /**
  2. * @author c-can-z
  3. */
  4. @EnableEurekaServer
  5. @SpringBootApplication
  6. public class EurekaApplication {
  7.  
  8. public static void main(String[] args) {
  9. SpringApplication.run(EurekaApplication.class,args);
  10. }
  11.  
  12. }

浏览器输入 http://localhost:8761/

步骤1 准备一个服务servicea --- 该服务为被调用者

创建一个普通springboot服务, 服务名称为 service-a
在该服务上, 创建一个端口, 该端口为:9992
访问该路径:
http://localhost:9991/user/get?id=5
返回为: 恭喜5号, 18岁的美美小姐
 
 

步骤2 准备一个服务serviceb --- 该服务为调用者

创建一个serviceb

添加一下serviceb必须的依赖

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5. <parent>
  6. <artifactId>test</artifactId>
  7. <groupId>com.fegin</groupId>
  8. <version>0.0.1-SNAPSHOT</version>
  9. </parent>
  10. <modelVersion>4.0.0</modelVersion>
  11.  
  12. <artifactId>serviceb</artifactId>
  13.  
  14. <dependencies>
  15. <!--springboot web-->
  16. <dependency>
  17. <groupId>org.springframework.boot</groupId>
  18. <artifactId>spring-boot-starter-web</artifactId>
  19. </dependency>
  20. <!--springboot 测试-->
  21. <dependency>
  22. <groupId>org.springframework.boot</groupId>
  23. <artifactId>spring-boot-starter-test</artifactId>
  24. <scope>test</scope>
  25. </dependency>
  26. <!--lombok-->
  27. <dependency>
  28. <groupId>org.projectlombok</groupId>
  29. <artifactId>lombok</artifactId>
  30. </dependency>
  31. <!--eureka客户端配置-->
  32. <dependency>
  33. <groupId>org.springframework.cloud</groupId>
  34. <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
  35. </dependency>
  36.  
  37. <dependency>
  38. <groupId>org.springframework.cloud</groupId>
  39. <artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
  40. </dependency>
  41. <!--微服务调用-->
  42. <dependency>
  43. <groupId>org.springframework.cloud</groupId>
  44. <artifactId>spring-cloud-starter-openfeign</artifactId>
  45. </dependency>
  46.  
  47. <!--zipkin客户端配置, 已经包含sleuth-->
  48. <dependency>
  49. <groupId>org.springframework.cloud</groupId>
  50. <artifactId>spring-cloud-starter-zipkin</artifactId>
  51. </dependency>
  52. </dependencies>
  53.  
  54. </project>

把 application.properties 修改为 application.yml, 本服务名称为 service-b 端口为 9992

  1. server:
  2. port: 9992
  3. spring:
  4. application:
  5. name: service-b
  6. zipkin:
  7. base-url: http://localhost:9411
  8. sleuth:
  9. sampler:
  10. probability: 1
  11. eureka:
  12. client:
  13. serviceUrl:
  14. defaultZone: http://localhost:8761/eureka/
  15. registry-fetch-interval-seconds: 5 #eureka client刷新本地缓存时间,默认30
  16. instance:
  17. prefer-ip-address: true
  18. #Eureka客户端向服务端发送心跳的时间间隔,单位为秒(客户端告诉服务端自己会按照该规则),默认30
  19. lease-renewal-interval-in-seconds: 5
  20. #Eureka服务端在收到最后一次心跳之后等待的时间上限,单位为秒,超过则剔除(客户端告诉服务端按照此规则等待自己),默认90
  21. lease-expiration-duration-in-seconds: 7
  22. feign:
  23. client:
  24. config:
  25. default:
  26. connectTimeout: 7000
  27. readTimeout: 7000
  28. service-b:
  29. ribbon:
  30. NFLoadBalancerRuleClassName: com.netflix.loadbalancer.RandomRule
  31. logging:
  32. level:
  33. root: info

导入启动类文件

  1. @SpringBootApplication
  2. @EnableFeignClients
  3. public class SeriveBApplication {
  4.  
  5. public static void main(String[] args) {
  6. SpringApplication.run(SeriveBApplication.class,args);
  7. }
  8.  
  9. }

创建Feign客户端

  1. //在创建该步骤的时候, 需要关注一下步骤1的说明
  2. //@FeignClient(name = "service-a")注解来绑定该接口对应servic-a服务
  3. @FeignClient(name = "service-a")
  4. public interface UserFeginClient {
  5. //service-a服务对应资源路径.必须加上@RequestParam, 否则会报错,返回参数也必须对应上
  6. @RequestMapping("user/get")
  7. String get(@RequestParam("id")Long id);
  8. }

在controller中直接进行调用

  1. @RestController
  2. @RequestMapping("/product")
  3. public class ProductController {
  4.  
  5. @Autowired
  6. private UserFeginClient userFeginClient;
  7.  
  8. @RequestMapping("/get")
  9. public String get(Long id){
  10. return "产品服务抽奖: "+userFeginClient.get(id);
  11. }
  12. }

步骤3 测试Feign调用效果

http://localhost:9992/product/get?id=5
 
到此, 是Fegin最简单的用法
 
相信如果按照我步骤一步一步做的同学, 应该可以理解什么是:
service-b 声明一个接口, 去调用路径为 /user/get 的服务 service-a 的服务
 

三 案例2 在被调用者接口Api中声明Feign客户端代码实现

步骤1 创建servicecapi, 该Api用来创建Feign客户端

可以在以上的项目上进行改造
项目结构
 
serviceapi依赖
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5. <parent>
  6. <artifactId>test</artifactId>
  7. <groupId>com.fegin</groupId>
  8. <version>0.0.1-SNAPSHOT</version>
  9. </parent>
  10. <modelVersion>4.0.0</modelVersion>
  11.  
  12. <artifactId>servicec-api</artifactId>
  13.  
  14. <dependencies>
  15. <!--lombok-->
  16. <dependency>
  17. <groupId>org.projectlombok</groupId>
  18. <artifactId>lombok</artifactId>
  19. </dependency>
  20.  
  21. <!--微服务调用-->
  22. <dependency>
  23. <groupId>org.springframework.cloud</groupId>
  24. <artifactId>spring-cloud-starter-openfeign</artifactId>
  25. </dependency>
  26. </dependencies>
  27. </project>

实体类product

  1. public class Product implements Serializable {
  2. private Long id;
  3. private String name;
  4.  
  5. public Long getId() {
  6. return id;
  7. }
  8.  
  9. public void setId(Long id) {
  10. this.id = id;
  11. }
  12.  
  13. public String getName() {
  14. return name;
  15. }
  16.  
  17. public void setName(String name) {
  18. this.name = name;
  19. }
  1. }

feign客户端

  1. /**
  2. * 服务名称
  3. * @author c-can-z
  4. */
  5. @FeignClient(name="service-c")
  6. public interface ProductFeignApi {
  7.  
  8. //动态代理需要的地址, 但是我们实际操作不到
  9. @RequestMapping("/servicec/get")
  10. Product get(@RequestParam("id") Long id);
  11. }

步骤2 创建servicec服务

项目结构

service项目依赖

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5. <parent>
  6. <artifactId>test</artifactId>
  7. <groupId>com.fegin</groupId>
  8. <version>0.0.1-SNAPSHOT</version>
  9. </parent>
  10. <modelVersion>4.0.0</modelVersion>
  11.  
  12. <artifactId>servicec</artifactId>
  13. <dependencies>
  14. <!--springboot web-->
  15. <dependency>
  16. <groupId>org.springframework.boot</groupId>
  17. <artifactId>spring-boot-starter-web</artifactId>
  18. </dependency>
  19. <!--eureka客户端配置-->
  20. <dependency>
  21. <groupId>org.springframework.cloud</groupId>
  22. <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
  23. </dependency>
  24.  
  25. <!--zipkin客户端配置, 已经包含sleuth-->
  26. <dependency>
  27. <groupId>org.springframework.cloud</groupId>
  28. <artifactId>spring-cloud-starter-zipkin</artifactId>
  29. </dependency>
  30.  
  31. <!--springboot 测试-->
  32. <dependency>
  33. <groupId>org.springframework.boot</groupId>
  34. <artifactId>spring-boot-starter-test</artifactId>
  35. <scope>test</scope>
  36. </dependency>
  37. <!--导入api-->
  38. <dependency>
  39. <groupId>com.fegin</groupId>
  40. <artifactId>servicec-api</artifactId>
  41. <version>0.0.1-SNAPSHOT</version>
  42. </dependency>
  43. </dependencies>
  44.  
  45. </project>

servicec的 application.yml

  1. server:
  2. port: 9993
  3. spring:
  4. application:
  5. name: service-c
  6. zipkin:
  7. base-url: http://localhost:9411
  8. sleuth:
  9. sampler:
  10. probability: 1
  11. eureka:
  12. client:
  13. serviceUrl:
  14. defaultZone: http://localhost:8761/eureka/
  15. registry-fetch-interval-seconds: 5 #eureka client刷新本地缓存时间,默认30
  16. instance:
  17. prefer-ip-address: true
  18. #Eureka客户端向服务端发送心跳的时间间隔,单位为秒(客户端告诉服务端自己会按照该规则),默认30
  19. lease-renewal-interval-in-seconds: 5
  20. #Eureka服务端在收到最后一次心跳之后等待的时间上限,单位为秒,超过则剔除(客户端告诉服务端按照此规则等待自己),默认90
  21. lease-expiration-duration-in-seconds: 7
  22. feign:
  23. client:
  24. config:
  25. default:
  26. connectTimeout: 7000
  27. readTimeout: 7000
  28. logging:
  29. level:
  30. root: info

实现Feign客户端接口, 也是该文章的核心代码

采用实现的方式

  1. /**
  2. * 远程调用接口的实现类
  3. * @author c-can-z
  4. */
  5. @RestController
  6. public class ProductFeignClient implements ProductFeignApi {
  7.  
  8. @Override
  9. public Product get(Long id) {
  10. Product product = new Product();
  11. product.setId(id);
  12. product.setName("我是服务C");
  13. return product;
  14. }
  15. }

servicec的启动类

  1. @SpringBootApplication
  2. public class ProductServerApplication {
  3. public static void main(String[] args) {
  4. SpringApplication.run(ProductServerApplication.class, args);
  5. }
  6. }

步骤3 创建serviced服务去调用servicec

项目结构

注意启动类的位置, servicecapi的路径必须被启动类扫描到

serviced的依赖,

注意, 必须引入servicec的api, 有人会说有代码侵入的问题, 但是对比案例1, 如果多个项目调用, 要创建多个Feign客户端, 孰是孰非, 还得看项目的具体需求

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5. <parent>
  6. <artifactId>test</artifactId>
  7. <groupId>com.fegin</groupId>
  8. <version>0.0.1-SNAPSHOT</version>
  9. </parent>
  10. <modelVersion>4.0.0</modelVersion>
  11.  
  12. <artifactId>serviced</artifactId>
  13.  
  14. <dependencies>
  15. <!--springboot web-->
  16. <dependency>
  17. <groupId>org.springframework.boot</groupId>
  18. <artifactId>spring-boot-starter-web</artifactId>
  19. </dependency>
  20. <!--springboot 测试-->
  21. <dependency>
  22. <groupId>org.springframework.boot</groupId>
  23. <artifactId>spring-boot-starter-test</artifactId>
  24. <scope>test</scope>
  25. </dependency>
  26. <!--lombok-->
  27. <dependency>
  28. <groupId>org.projectlombok</groupId>
  29. <artifactId>lombok</artifactId>
  30. </dependency>
  31. <!--eureka客户端配置-->
  32. <dependency>
  33. <groupId>org.springframework.cloud</groupId>
  34. <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
  35. </dependency>
  36. <!--微服务调用-->
  37. <dependency>
  38. <groupId>org.springframework.cloud</groupId>
  39. <artifactId>spring-cloud-starter-openfeign</artifactId>
  40. </dependency>
  41. <!--zipkin客户端配置, 已经包含sleuth-->
  42. <dependency>
  43. <groupId>org.springframework.cloud</groupId>
  44. <artifactId>spring-cloud-starter-zipkin</artifactId>
  45. </dependency>
  46.  
  47. <dependency>
  48. <groupId>com.fegin</groupId>
  49. <artifactId>servicec-api</artifactId>
  50. <version>0.0.1-SNAPSHOT</version>
  51. </dependency>
  52. </dependencies>
  53. </project>

serviced的 application.yml

  1. server:
  2. port: 9994
  3. spring:
  4. application:
  5. name: service-d
  6. zipkin:
  7. base-url: http://localhost:9411
  8. sleuth:
  9. sampler:
  10. probability: 1
  11. eureka:
  12. client:
  13. serviceUrl:
  14. defaultZone: http://localhost:8761/eureka/
  15. registry-fetch-interval-seconds: 5 #eureka client刷新本地缓存时间,默认30
  16. instance:
  17. prefer-ip-address: true
  18. #Eureka客户端向服务端发送心跳的时间间隔,单位为秒(客户端告诉服务端自己会按照该规则),默认30
  19. lease-renewal-interval-in-seconds: 5
  20. #Eureka服务端在收到最后一次心跳之后等待的时间上限,单位为秒,超过则剔除(客户端告诉服务端按照此规则等待自己),默认90
  21. lease-expiration-duration-in-seconds: 7
  22. feign:
  23. client:
  24. config:
  25. default:
  26. connectTimeout: 7000
  27. readTimeout: 7000
  28. logging:
  29. level:
  30. root: info

serviced的控制类

  1. /**
  2. * @author c-can-z
  3. */
  4. @RestController
  5. @RequestMapping("/order")
  6. public class OrderController {
  7.  
  8. @Autowired
  9. private ProductFeignApi productFeignApi;
  10.  
  11. @RequestMapping("/get")
  12. public String get(Long id){
  13. Product product = productFeignApi.get(id);
  14. return "订单为: 货品:" + product.getName() + ", 货品id:"+product.getId();
  15. }
  16. }

serviced的启动类

  1. /**
  2. * @author c-can-z
  3. */
  4. @SpringBootApplication
  5. @EnableFeignClients
  6. public class ServiceDApplication {
  7. public static void main(String[] args) {
  8. SpringApplication.run(ServiceDApplication.class,args);
  9. }
  10. }

步骤4 测试Feign调用效果

http://localhost:9994/order/get?id=5

四 总结

到了这里, 不知道你是否理解 直接在调用者声明Feign客户端 或者 在被调用者接口Api中声明Feign客户端

直接在调用者声明Feign客户端:

每一个服务调用其他服务, 就需要创建一个客户端, 从代码方面来说, 相对比较麻烦

在被调用者接口Api中声明Feign客户端:

从调用者来看, 使用起来就跟使用淘宝的dubbo一样方便, 但是每一个服务调用其他服务, 就需要引入其他服务的api依赖, 从项目之间的互相依赖来看, 相对来说, 也会比较麻烦.

分布式远程调用SpringCloud-Feign的两种具体操作方式(精华)的更多相关文章

  1. Atitit.分布式远程调用  rpc  rmi  CORBA的关系

    Atitit.分布式远程调用  rpc  rmi  CORBA的关系 1. 远程调用(包括rpc,rmi,rest)1 2. 分布式调用大体上就分为两类,RPC式的,REST式的1 3. RPC(远程 ...

  2. WCF 客户端调用服务操作的两种方法

    本节的主要内容:1.通过代理类的方式调用服务操作.2.通过通道的方式调用服务操作.3.代码下载 一.通过代理类的方式调用服务操作(两种方式添加代理类) 1.手动编写代理类,如下: 客户端契约: usi ...

  3. C#动态调用WCF接口,两种方式任你选。

    写在前面 接触WCF还是它在最初诞生之处,一个分布式应用的巨作. 从开始接触到现在断断续续,真正使用的项目少之又少,更谈不上深入WCF内部实现机制和原理去研究,最近自己做一个项目时用到了WCF. 从这 ...

  4. SoapUI调用webservice实现的两种方式

    SoapUI用来做测试,已经是很多人做过的事情了,而且网上教程也很多.不过还是写下来,对比webservice协议与http协议脚本编写的不同. 首先测接口得有一个服务,刚好笔者所在项目做ESB集成. ...

  5. java中调用dll文件的两种方法

    一中是用JNA方法,另外是用JNative方法,两种都是转载来的, JNA地址:http://blog.csdn.net/shendl/article/details/3589676   JNativ ...

  6. JGit与远程仓库链接使用的两种验证方式(ssh和https)

    JGit是使用JAVA的API来操控Git仓库的库,由Eclipse公司维护.他提供的API分成两个层次,底层命令和高层命令.底层API是直接作用于低级的仓库对象,高层的API是一个面向普通用户级别功 ...

  7. rsync 远程同步 实时同步备份 两种免交互的方式实现实时备份

    rsync 远程同步: 一款快速增量备份工具 Remote Sync,远程同步 支持本地复制,或者与其他SSH.rsync主机同步 作用:做数据备份 备份方式:      完全备份      增量备份 ...

  8. JGit与远程仓库链接使用的两种验证方式(ssh和https)

    JGit是使用JAVA的API来操控Git仓库的库,由Eclipse公司维护.他提供的API分成两个层次,底层命令和高层命令.底层API是直接作用于低级的仓库对象,高层的API是一个面向普通用户级别功 ...

  9. C++调用C代码的两种方式

    由于C++支持函数重载,在编译函数代码的时候会加上参数类型的信息,而C编译只有函数名信息,导致C++直接调用C代码在链接的时候会出现函数未定义的问题.解决这种问题有两种方法.方法一:在写C代码的时候考 ...

随机推荐

  1. requests+lxml+xpath爬取电影天堂

    1.导入相应的包 import requests from lxml import etree 2.原始ur url="https://www.dytt8.net/html/gndy/dyz ...

  2. css过渡transition属性

    一.CSS3 过渡 (一).CSS3过渡简介 CSS3过渡是元素从一种样式逐渐改变为另一种的效果. 实现过渡效果的两个要件: 规定把效果添加到哪个 CSS 属性上 规定效果的时长 定义动画的规则 过渡 ...

  3. nginx基于uwsgi部署Django

    1.安装nginx yum install -y nginx(需要epel源) 2.安装uwsgi yum groupinstall "Development tools" yum ...

  4. java 时间戳 、时间差计算(秒、分钟、小时、天数、月份、年)

    以下代码就是时间差计算(秒.分钟.小时.天数.月份.年) package me.zhengjie; import java.text.ParseException; import java.text. ...

  5. Java 给Word指定字符串添加批注

    本文将介绍在Java程序中如何给Word文档中的指定字符串添加批注.前文中,主要介绍的是针对某个段落来添加批注,以及回复.编辑.删除批注的方法,如果需要针对特定关键词或指定字符串来设置批注,可以参考本 ...

  6. li列表循环滚动的简单方法,无需插件,简单方法搞定

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  7. 微服务架构案例(05):SpringCloud 基础组件应用设计

    本文源码:GitHub·点这里 || GitEE·点这里 更新进度(共6节): 01:项目技术选型简介,架构图解说明 02:业务架构设计,系统分层管理 03:数据库选型,业务数据设计规划 04:中间件 ...

  8. 【已解决】ArcGIS Engine无法创建拓扑的问题(CreateTopology)

    也许,你的问题是这样的 ①System.Runtime.InteropServices.COMException:"未找到拓扑." ②myTopology结果是null,程序跳转到 ...

  9. 利用AXI VDMA实现OV5640摄像头采集笔记(二)

    导读:摄像头采样图像数据后经过VDMA进入DDR,通过PS部分控制,经过三级缓存,将DDR中保持的图形数据通过VDMA发送出去.在FPGA的接收端口产生VID OUT时序驱动HDMI显示器显示图形. ...

  10. 千与千寻主题曲beep函数版

    在出代码之前,我们向来了解一下Beep函数. 例: Beep(,); 这个表示575Hz响100ms. 下面给出代码: #include <bits/stdc++.h> #include ...