当前位置: 首页 > news >正文

eureka注册中心和RestTemplate

eureka注册中心和restTemplate的使用说明

eureka的作用

  • 消费者该如何获取服务提供者的具体信息

    1.服务者启动时向eureka注册自己的信息

    2.eureka保存这些信息

    3.消费者根据服务名称向eureka拉去提供者的信息

  • 如果有多个服务提供者,消费者该如何选择?

    服务消费者利用负载均衡算法,从服务列表中挑选一个

  • 消费者如何感知服务提供者的健康状态?

    服务提供者每隔30s向eurekaserver发送心跳请求,报告健康状态。

    eureka会更新记录服务列表信息,心跳不正常会被剔除。

    消费者就可以拉取到最新的消息。

在这里插入图片描述

搭载eureka注册中心

1.引入依赖

    <dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-eureka-server</artifactId></dependency></dependencies>

2.在启动类加@EnableEurekaServer注解

3.编写配置文件

server:port: 10086 #端口spring:application:name: eurekaserver #应用名eureka:client:service-url: #eureka注册中心地址defaultZone: http://localhost:10086/eureka

服务注册

1.加入eureka客服端的依赖

		<dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-eureka-client</artifactId></dependency>

2.添加客服端的配置

eureka:client:service-url:defaultZone: http://localhost:10086/eureka

服务发现

1.修改url访问路径,用服务名代替ip地址

package cn.itcast.order.web;import cn.itcast.order.pojo.Order;
import cn.itcast.order.pojo.User;
import cn.itcast.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;@RestController
@RequestMapping("order")
public class OrderController {@Autowiredprivate OrderService orderService;@Autowiredprivate RestTemplate restTemplate;@GetMapping("{orderId}")public Order queryOrderByUserId(@PathVariable("orderId") Long orderId) {// 根据id查询订单并返回Order order = orderService.queryOrderById(orderId);String url="http://userserver/user/"+order.getUserId();User user = restTemplate.getForObject(url, User.class);order.setUser(user);return order;}
}

2.加负载均衡的注解

package cn.itcast.order;import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;@MapperScan("cn.itcast.order.mapper")
@SpringBootApplication
public class OrderApplication {public static void main(String[] args) {SpringApplication.run(OrderApplication.class, args);}@Bean@LoadBalancedpublic RestTemplate restTemplate() {return new RestTemplate();}/* @Beanpublic IRule randomRule(){return new RandomRule();}*/}

负载均衡

在这里插入图片描述

1.通过定义IRule实现可以修改负载均衡的规则


import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;@Bean
public IRule randomRule(){return new RandomRule();
}

2.通过配置文件更改负载均衡规则

userservice: # 给某个微服务配置负载均衡规则,这里是userservice服务ribbon:NFLoadBalancerRuleClassName: com.netflix.loadbalancer.RandomRule # 负载均衡规则

RestTemplate接口调用

简介

在项目中,当我们需要远程调用一个 HTTP 接口时,我们经常会用到 RestTemplate 这个类。这个类是 Spring 框架提供的一个工具类。

RestTemplate: The original Spring REST client with a synchronous, template method API.

从上面的介绍中我们可以知道:RestTemplate 是一个同步的 Rest API 客户端。下面我们就来介绍下 RestTemplate 的常用功能。

RestTemplate的使用

1.创建 RestTemplate

@Bean
public RestTemplate restTemplate(ClientHttpRequestFactory factory) {RestTemplate restTemplate = new RestTemplate(factory);return restTemplate;
}/*** 创建 RestTemplate 时需要一个 ClientHttpRequestFactory,* 通过这个请求工厂,我们可以统一设置请求的超时时间,设置代理以及一些其他细节。* 通过上面代码配置后,我们直接在代码中注入 RestTemplate 就可以使用了。* @return*/
@Bean
public ClientHttpRequestFactory simpleClientHttpRequestFactory() {SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();factory.setReadTimeout(5000);factory.setConnectTimeout(15000);// 设置代理//factory.setProxy(null);return factory;
}

2.方法介绍

getForObject

public <T> T getForObject(String url, Class<T> responseType, Object... uriVariables)public <T> T getForObject(String url, Class<T> responseType, Map<String, ?> uriVariables)
  • 参数1:http请求路径
  • 参数2:返回值类型
  • 参数3:url参数 传参数的方式不一样而已,本质是一样的
@Resource
private RestTemplate restTemplate;@Testvoid testGetRequestForShopById() {String url="http://127.0.0.1:8081/shop/{id}";Result result = restTemplate.getForObject(url, Result.class, 1);System.out.println(result);}
# 响应结果
Result(success=true, errorMsg=null, data={id=1, name=103茶餐厅, typeId=1, images=https://qcloud.dpfile.com/pc/jiclIsCKmOI2arxKN1Uf0Hx3PucIJH8q0QSz-Z8llzcN56-_QiKuOvyio1OOxsRtFoXqu0G3iT2T27qat3WhLVEuLYk00OmSS1IdNpm8K8sG4JN9RIm2mTKcbLtc2o2vfCF2ubeXzk49OsGrXt_KYDCngOyCwZK-s3fqawWswzk.jpg,https://qcloud.dpfile.com/pc/IOf6VX3qaBgFXFVgp75w-KKJmWZjFc8GXDU8g9bQC6YGCpAmG00QbfT4vCCBj7njuzFvxlbkWx5uwqY2qcjixFEuLYk00OmSS1IdNpm8K8sG4JN9RIm2mTKcbLtc2o2vmIU_8ZGOT1OjpJmLxG6urQ.jpg, area=大关, address=金华路锦昌文华苑29, x=120.149192, y=30.316078, avgPrice=80, sold=4215, comments=3035, score=37, openHours=10:00-22:00, createTime=2021-12-22T18:10:39, updateTime=2023-04-06T22:18:52}, total=null)

getForEntity

public <T> ResponseEntity<T> getForEntity(String url, Class<T> responseType, Object... uriVariables)public <T> ResponseEntity<T> getForEntity(String url, Class<T> responseType, Map<String, ?> uriVariables)public <T> ResponseEntity<T> getForEntity(URI url, Class<T> responseType)
 	/*** 这个方法比getforobject多了一层包装。可以获取更多的响应信息*/@Testvoid testGetRequestForShopById_getForEntity() {String url="http://127.0.0.1:8081/shop/{id}";ResponseEntity<Result> response = restTemplate.getForEntity(url, Result.class,1);Result body = response.getBody();System.out.println(body);}

响应结果

Result(success=true, errorMsg=null, data={id=1, name=103茶餐厅, typeId=1, images=https://qcloud.dpfile.com/pc/jiclIsCKmOI2arxKN1Uf0Hx3PucIJH8q0QSz-Z8llzcN56-_QiKuOvyio1OOxsRtFoXqu0G3iT2T27qat3WhLVEuLYk00OmSS1IdNpm8K8sG4JN9RIm2mTKcbLtc2o2vfCF2ubeXzk49OsGrXt_KYDCngOyCwZK-s3fqawWswzk.jpg,https://qcloud.dpfile.com/pc/IOf6VX3qaBgFXFVgp75w-KKJmWZjFc8GXDU8g9bQC6YGCpAmG00QbfT4vCCBj7njuzFvxlbkWx5uwqY2qcjixFEuLYk00OmSS1IdNpm8K8sG4JN9RIm2mTKcbLtc2o2vmIU_8ZGOT1OjpJmLxG6urQ.jpg, area=大关, address=金华路锦昌文华苑29号, x=120.149192, y=30.316078, avgPrice=80, sold=4215, comments=3035, score=37, openHours=10:00-22:00, createTime=2021-12-22T18:10:39, updateTime=2023-04-06T22:18:52}, total=null)

head请求用的很少见。

Head 与服务器索与get请求一致的相应,响应体不会返回,获取包含在小消息头中的原信息(与get请求类似,返回的响应中没有具体内容,用于获取报头)

HEAD和GET本质是一样的,区别在于HEAD不含有呈现数据,而仅仅是HTTP头信息。有的人可能觉得这个方法没什么用,其实不是这样的。想象一个业务情景:欲判断某个资源是否存在,我们通常使用GET,但这里用HEAD则意义更加明确。

public HttpHeaders headForHeaders(String url, Object... uriVariables)
public HttpHeaders headForHeaders(String url, Map<String, ?> uriVariables)
public HttpHeaders headForHeaders(URI url)
@Testvoid headForHeaders() throws URISyntaxException {String url="http://127.0.0.1:8081/shop-type/list";URI uri = new URI(url);HttpHeaders headers = restTemplate.headForHeaders(uri);System.out.println(headers.toString());}

head请求的响应

[Content-Type:"application/json", Content-Length:"652", Date:"Wed, 19 Apr 2023 09:49:28 GMT", Keep-Alive:"timeout=60", Connection:"keep-alive"]

在之后的内容之前我们先看看restTemplate的拦截器设置,主要设置请求头或者一些权限认证的需要


import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpRequest;
import org.springframework.http.client.ClientHttpRequestExecution;
import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.http.client.ClientHttpResponse;import java.io.IOException;public class MyRestTemplateInterceptor implements ClientHttpRequestInterceptor {@Overridepublic ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {HttpHeaders headers = request.getHeaders();//设置请求头 做权限认证headers.set("authorization","50da33fa5c0a4ccea49a08bcdf3ee757");return execution.execute(request,body);}
}

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;import java.util.ArrayList;
import java.util.List;@Configuration
public class RestTemplateConfig {@Beanpublic RestTemplate restTemplate(ClientHttpRequestFactory factory){RestTemplate restTemplate = new RestTemplate(factory);MyRestTemplateInterceptor restTemplateInterceptor = new MyRestTemplateInterceptor();List<ClientHttpRequestInterceptor> list=new ArrayList<>(1);list.add(restTemplateInterceptor);restTemplate.setInterceptors(list);return restTemplate;}/*@Beanpublic RestTemplate restTemplate(ClientHttpRequestFactory factory){return new RestTemplate(factory);}*//*** 创建 RestTemplate 时需要一个 ClientHttpRequestFactory,* 通过这个请求工厂,我们可以统一设置请求的超时时间,设置代理以及一些其他细节。* 通过上面代码配置后,我们直接在代码中注入 RestTemplate 就可以使用了。* @return*/@Beanpublic ClientHttpRequestFactory simpleClientHttpRequestFactory(){SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();//设置超时的时间factory.setConnectTimeout(10000);//客户端从服务端读取数据的超时时间factory.setReadTimeout(10000);// 设置代理//factory.setProxy(null);return factory;}}

postForLocation方法

public URI postForLocation(String url, @Nullable Object request, Object... uriVariables)
public URI postForLocation(String url, @Nullable Object request, Map<String, ?> uriVariables)/***不做过多的介绍了* 主要是与上面的也大差不差。*/

最后我们看restTemplate中最丰富的一个方法。不用配置拦截器也能实现设置请求头。

exchange这个方法的重载也不少

public <T> ResponseEntity<T> exchange(String url, HttpMethod method,@Nullable HttpEntity<?> requestEntity, Class<T> responseType, Object... uriVariables)public <T> ResponseEntity<T> exchange(String url, HttpMethod method,@Nullable HttpEntity<?> requestEntity, Class<T> responseType, Map<String, ?> uriVariables)
  • 参数一:url 请求路径

  • 参数二:method 请求方式

  • 参数三:requestEntity

    这个可以设置请求体和请求头,我们看一下这个类的构造器,我挑了一个参数最多的构造器。

    很明显第一个参数就是请求体,第二个参数就是设置请求头的一个map。

    也就是说我们不用设置拦截器就可以实现复杂的http请求

    public HttpEntity(@Nullable T body, @Nullable MultiValueMap<String, String> headers) {this.body = body;HttpHeaders tempHeaders = new HttpHeaders();if (headers != null) {tempHeaders.putAll(headers);}this.headers = HttpHeaders.readOnlyHttpHeaders(tempHeaders);}
  • 参数四:responseType 响应值类型

  • 参数五:url参数 也可以理解为请求行参数。

底下是一个实列。

/*** get请求设置请求头!* 设置url参数*/@Testvoid testGetRequestForShop() {long shopId = 1l;/*** authorization: ba8d06d954a04c32bc1e75e2625fe192*/String url="http://127.0.0.1:8081/shop/{id}";HttpHeaders httpHeaders=new HttpHeaders();httpHeaders.add("authorization","ba8d06d954a04c32bc1e75e2625fe192");HttpEntity httpEntity=new HttpEntity(httpHeaders);ResponseEntity<Result> result = restTemplate.exchange(url, HttpMethod.GET, httpEntity, Result.class, shopId);System.out.println(result.getStatusCode());System.out.println("============header==============");System.out.println(result.getHeaders());System.out.println("=============result==============");Object data = result.getBody().getData();System.out.println(data);}

Entity=new HttpEntity(httpHeaders);

    ResponseEntity<Result> result = restTemplate.exchange(url, HttpMethod.GET, httpEntity, Result.class, shopId);System.out.println(result.getStatusCode());System.out.println("============header==============");System.out.println(result.getHeaders());System.out.println("=============result==============");Object data = result.getBody().getData();System.out.println(data);
}

相关文章:

eureka注册中心和RestTemplate

eureka注册中心和restTemplate的使用说明 eureka的作用 消费者该如何获取服务提供者的具体信息 1.服务者启动时向eureka注册自己的信息 2.eureka保存这些信息 3.消费者根据服务名称向eureka拉去提供者的信息 如果有多个服务提供者&#xff0c;消费者该如何选择&#xff1f; 服…...

redis复制的设计与实现

一、复制 1.1旧版功能的实现 旧版Redis的复制功能分为 同步&#xff08;sync&#xff09;和 命令传播。 同步用于将从服务器更新至主服务器的当前状态。命令传播用于 主服务器状态变化时&#xff0c;让主从服务器状态回归一致。 1.1.1同步 当客户端向服务端发送slaveof命令…...

Docker更换国内镜像源

什么是Docker Docker 是一个开源的应用容器引擎&#xff0c;基于 Go 语言 并遵从 Apache2.0 协议开源。 Docker 可以让开发者打包他们的应用以及依赖包到一个轻量级、可移植的容器中&#xff0c;然后发布到任何流行的 Linux 机器上&#xff0c;也可以实现虚拟化。 容器是完全…...

【网络编程】网络套接字,UDP,TCP套接字编程

前言 小亭子正在努力的学习编程&#xff0c;接下来将开启javaEE的学习~~ 分享的文章都是学习的笔记和感悟&#xff0c;如有不妥之处希望大佬们批评指正~~ 同时如果本文对你有帮助的话&#xff0c;烦请点赞关注支持一波, 感激不尽~~ 特别说明&#xff1a;本文分享的代码运行结果…...

海斯坦普Gestamp EDI 需求分析

海斯坦普Gestamp&#xff08;以下简称&#xff1a;Gestamp&#xff09;是一家总部位于西班牙的全球性汽车零部件制造商&#xff0c;目前在全球23个国家拥有超过100家工厂。Gestamp的业务涵盖了车身、底盘和机电系统等多个领域&#xff0c;其产品范围包括钣金、车身结构件、车轮…...

gpt写文章批量写文章-gpt3中文生成教程

怎么用gpt写文章批量写文章 批量写作文章是很多网站、营销人员、编辑等需要的重要任务&#xff0c;GPT可以帮助您快速生成大量自然、通顺的文章。下面是一个简单的步骤介绍&#xff0c;告诉您如何使用GPT批量写作文章。 步骤1&#xff1a;选择好训练模型 首先&#xff0c;选…...

HashMap实现原理

HashMap是基于散列表的Map接口的实现。插入和查询的性能消耗是固定的。可以通过构造器设置容量和负载因子&#xff0c;一调整容易得性能。 散列表&#xff1a;给定表M&#xff0c;存在函数f(key)&#xff0c;对任意给定的关键字值key&#xff0c;代入函数后若能得到包含该关键字…...

【Java 数据结构】PriorityQueue(堆)的使用及源码分析

&#x1f389;&#x1f389;&#x1f389;点进来你就是我的人了 博主主页&#xff1a;&#x1f648;&#x1f648;&#x1f648;戳一戳,欢迎大佬指点!人生格言&#xff1a;当你的才华撑不起你的野心的时候,你就应该静下心来学习! 欢迎志同道合的朋友一起加油喔&#x1f9be;&am…...

使用 Kubernetes 运行 non-root .NET 容器

翻译自 Richard Lander 的博客 Rootless 或 non-root Linux 容器一直是 .NET 容器团队最需要的功能。我们最近宣布了所有 .NET 8 容器镜像都可以通过一行代码配置为 non-root 用户。今天的文章将介绍如何使用 Kubernetes 处理 non-root 托管。 您可以尝试使用我们的 non-root…...

为什么大量失业集中爆发在2023年?被裁?别怕!失业是跨越职场瓶颈的关键一步!对于牛逼的人,这是白捡N+1!...

被裁究竟是因为自身能力不行&#xff0c;还是因为大环境不行&#xff1f; 一位网友说&#xff1a; 被裁后找不到工作&#xff0c;本质上还是因为原来的能力就配不上薪资。如果确实有技术在身&#xff0c;根本不怕被裁&#xff0c;相当于白送n1&#xff01; 有人赞同楼主的观点&…...

Word控件Spire.Doc 【脚注】字体(3):将Doc转换为PDF时如何使用卸载的字体

Spire.Doc for .NET是一款专门对 Word 文档进行操作的 .NET 类库。在于帮助开发人员无需安装 Microsoft Word情况下&#xff0c;轻松快捷高效地创建、编辑、转换和打印 Microsoft Word 文档。拥有近10年专业开发经验Spire系列办公文档开发工具&#xff0c;专注于创建、编辑、转…...

keil5使用c++编写stm32控制程序

keil5使用c编写stm32控制程序 一、前言二、配置图解三、std::cout串口重定向四、串口中断服务函数五、结尾废话 一、前言 想着搞个新奇的玩意玩一玩来着&#xff0c;想用c编写代码来控制stm32&#xff0c;结果在keil5中&#xff0c;把踩给我踩闷了&#xff0c;这里简单记录一下…...

中国社科院与美国杜兰大学金融管理硕士项目——在职读研的日子里藏着我们未来无限可能

人生充满期待&#xff0c;梦想连接着未来。每一天都可以看作新的一页&#xff0c;要努力去成为最好的自己。在职读研的光阴里藏着无限的可能&#xff0c;只有不断的努力&#xff0c;不断的强大自己&#xff0c;未来会因为你的不懈坚持而发生改变&#xff0c;纵使眼前看不到希望…...

hardhat 本地连接matemask钱包

Hardhat 安装 https://hardhat.org/hardhat-runner/docs/getting-started#quick-start Running a Local Hardhat Network Hardhat greatly simplifies the process of setting up a local network by having an in-built local blockchain which can be easily run through a…...

【华为OD机试真题】1001 - 在字符串中找出连续最长的数字串含-号(Java C++ Python JS)| 机试题+算法思路+考点+代码解析

文章目录 一、题目🔸题目描述🔸输入输出二、代码参考🔸Java代码🔸 C++代码🔸 Python代码🔸 JS代码作者:KJ.JK🌈 🌈 🌈 🌈 🌈 🌈 🌈 🌈 🌈 🌈 🌈 🌈 🌈 🍂个人博客首页: KJ.JK 💖系列专栏:华为OD机试(Java C++ Python JS)...

CrackMapExec 域渗透工具使用

提示&#xff1a;文章写完后&#xff0c;目录可以自动生成&#xff0c;如何生成可参考右边的帮助文档 文章目录 前言一、CrackMapExec 是什么&#xff1f;二、简单使用1、获取帮助信息2、smb连接执行命令3、使用winrm执行命令&#xff08;躲避杀软&#xff09;4、smb 协议常用枚…...

Modbus协议学习

以下内容从参考文章学习提炼 [参考文章](https://www.cnblogs.com/The-explosion/p/11512677.html) ## 基本概念 Modbus用的是主从通讯技术&#xff0c;主设备操作查询从设备。可以通过物理接口&#xff0c;可选用串口&#xff08;RS232、RS485、RS422&#xff09;&#xff0c…...

camunda如何处理流程待办任务

在 Camunda 中处理流程任务需要使用 Camunda 提供的 API 或者用户界面进行操作。以下是两种常用的处理流程任务的方式&#xff1a; 1、通过 Camunda 任务列表处理任务&#xff1a;在 Camunda 任务列表中&#xff0c;可以看到当前需要处理的任务&#xff0c;点击任务链接&#…...

git部分文件不想提交解决方案

正确的做法应该是&#xff1a;git rm --cached logs/xx.log&#xff0c;然后更新 .gitignore 忽略掉目标文件&#xff0c;最后 git commit -m "We really dont want Git to track this anymore!" 具体的原因如下&#xff1a; 被采纳的答案虽然能达到&#xff08;暂…...

2023年全国最新道路运输从业人员精选真题及答案58

百分百题库提供道路运输安全员考试试题、道路运输从业人员考试预测题、道路安全员考试真题、道路运输从业人员证考试题库等&#xff0c;提供在线做题刷题&#xff0c;在线模拟考试&#xff0c;助你考试轻松过关。 69.根据《公路水路行业安全生产风险管理暂行办法》&#xff0c;…...

【Linux】shell脚本忽略错误继续执行

在 shell 脚本中&#xff0c;可以使用 set -e 命令来设置脚本在遇到错误时退出执行。如果你希望脚本忽略错误并继续执行&#xff0c;可以在脚本开头添加 set e 命令来取消该设置。 举例1 #!/bin/bash# 取消 set -e 的设置 set e# 执行命令&#xff0c;并忽略错误 rm somefile…...

React hook之useRef

React useRef 详解 useRef 是 React 提供的一个 Hook&#xff0c;用于在函数组件中创建可变的引用对象。它在 React 开发中有多种重要用途&#xff0c;下面我将全面详细地介绍它的特性和用法。 基本概念 1. 创建 ref const refContainer useRef(initialValue);initialValu…...

React Native 导航系统实战(React Navigation)

导航系统实战&#xff08;React Navigation&#xff09; React Navigation 是 React Native 应用中最常用的导航库之一&#xff0c;它提供了多种导航模式&#xff0c;如堆栈导航&#xff08;Stack Navigator&#xff09;、标签导航&#xff08;Tab Navigator&#xff09;和抽屉…...

SCAU期末笔记 - 数据分析与数据挖掘题库解析

这门怎么题库答案不全啊日 来简单学一下子来 一、选择题&#xff08;可多选&#xff09; 将原始数据进行集成、变换、维度规约、数值规约是在以下哪个步骤的任务?(C) A. 频繁模式挖掘 B.分类和预测 C.数据预处理 D.数据流挖掘 A. 频繁模式挖掘&#xff1a;专注于发现数据中…...

Java多线程实现之Thread类深度解析

Java多线程实现之Thread类深度解析 一、多线程基础概念1.1 什么是线程1.2 多线程的优势1.3 Java多线程模型 二、Thread类的基本结构与构造函数2.1 Thread类的继承关系2.2 构造函数 三、创建和启动线程3.1 继承Thread类创建线程3.2 实现Runnable接口创建线程 四、Thread类的核心…...

C++.OpenGL (14/64)多光源(Multiple Lights)

多光源(Multiple Lights) 多光源渲染技术概览 #mermaid-svg-3L5e5gGn76TNh7Lq {font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-3L5e5gGn76TNh7Lq .error-icon{fill:#552222;}#mermaid-svg-3L5e5gGn76TNh7Lq .erro…...

浪潮交换机配置track检测实现高速公路收费网络主备切换NQA

浪潮交换机track配置 项目背景高速网络拓扑网络情况分析通信线路收费网络路由 收费汇聚交换机相应配置收费汇聚track配置 项目背景 在实施省内一条高速公路时遇到的需求&#xff0c;本次涉及的主要是收费汇聚交换机的配置&#xff0c;浪潮网络设备在高速项目很少&#xff0c;通…...

苹果AI眼镜:从“工具”到“社交姿态”的范式革命——重新定义AI交互入口的未来机会

在2025年的AI硬件浪潮中,苹果AI眼镜(Apple Glasses)正在引发一场关于“人机交互形态”的深度思考。它并非简单地替代AirPods或Apple Watch,而是开辟了一个全新的、日常可接受的AI入口。其核心价值不在于功能的堆叠,而在于如何通过形态设计打破社交壁垒,成为用户“全天佩戴…...

破解路内监管盲区:免布线低位视频桩重塑停车管理新标准

城市路内停车管理常因行道树遮挡、高位设备盲区等问题&#xff0c;导致车牌识别率低、逃费率高&#xff0c;传统模式在复杂路段束手无策。免布线低位视频桩凭借超低视角部署与智能算法&#xff0c;正成为破局关键。该设备安装于车位侧方0.5-0.7米高度&#xff0c;直接规避树枝遮…...

永磁同步电机无速度算法--基于卡尔曼滤波器的滑模观测器

一、原理介绍 传统滑模观测器采用如下结构&#xff1a; 传统SMO中LPF会带来相位延迟和幅值衰减&#xff0c;并且需要额外的相位补偿。 采用扩展卡尔曼滤波器代替常用低通滤波器(LPF)&#xff0c;可以去除高次谐波&#xff0c;并且不用相位补偿就可以获得一个误差较小的转子位…...