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

绵阳网站建设公司/企业seo关键词优化

绵阳网站建设公司,企业seo关键词优化,wordpress实现table,怎么网上宣传自己的产品💻目录 1、介绍2、使用2.1、添加配置2.1.1、依赖2.1.2、工具类2.1.3、实体2.1.4、Controller接口 2.2、Apache HttpClient使用2.3 、OkHttp使用2.4、WebClient使用 1、介绍 现在java使用的http客户端主要包括以下几种 而这些中使用得最频繁的主要是: A…

💻目录

  • 1、介绍
  • 2、使用
    • 2.1、添加配置
      • 2.1.1、依赖
      • 2.1.2、工具类
      • 2.1.3、实体
      • 2.1.4、Controller接口
    • 2.2、Apache HttpClient使用
    • 2.3 、OkHttp使用
    • 2.4、WebClient使用

1、介绍

现在java使用的http客户端主要包括以下几种
java使用http通讯
而这些中使用得最频繁的主要是:

  1. Apache HttpClient:这是一个功能强大且广泛使用的第三方库,用于进行HTTP通讯。它提供了更高级的API和更丰富的功能,比如支持连接池、认证、重定向、Cookie管理等。Apache HttpClient可以作为独立的库使用,也可以作为Apache HttpComponents项目的一部分。

  2. OkHttp:这是另一个流行的第三方库,用于进行HTTP通讯。OkHttp提供了简洁的API和高性能的特性,支持同步和异步请求,以及连接池、缓存、拦截器等功能。OkHttp也是Square公司的一个开源项目。

  3. Spring WebClient:这是Spring框架中的一个模块,是RestTemplate的升级版,用于进行非阻塞的HTTP通讯。它基于Reactive Streams编程模型,适用于构建响应式的应用程序。Spring WebClient提供了简单的API来发送HTTP请求和处理响应,可以与Spring WebFlux等模块一起使用。

2、使用

下面展示了Apache HttpClient和OkHttp以及Spring WebClient的常用使用方式,包括get和post

2.1、添加配置

2.1.1、依赖

        <!-- https://mvnrepository.com/artifact/org.apache.httpcomponents.client5/httpclient5 --><dependency><groupId>org.apache.httpcomponents.client5</groupId><artifactId>httpclient5</artifactId></dependency><!--okhttp--><dependency><groupId>com.squareup.okhttp3</groupId><artifactId>okhttp</artifactId></dependency><dependency><groupId>cn.hutool</groupId><artifactId>hutool-all</artifactId><version>5.8.22</version></dependency><!--webClient--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-webflux</artifactId></dependency>

2.1.2、工具类

  • Result:统一返回类
@Data
public class Result<T> {//状态码private Integer code;//信息private String message;//数据private T data;private Result(){}//设置数据,返回对象的方法public static <T> Result<T> build(T data, ResultCodeEnum resultCodeEnum) {//创建Result对象,设置值,返回对象Result<T> result = new Result<>();//判断返回结果中是否需要数据if (data != null) {//设置数据到result对象result.setData(data);}//设置其他值result.setCode(resultCodeEnum.getCode());result.setMessage(resultCodeEnum.getMessage());//返回设置值之后的对象return result;}//成功的方法public static <T> Result<T> ok(T data) {return build(data, ResultCodeEnum.SUCCESS);}//成功的方法public static <T> Result<T> ok() {return build(null, ResultCodeEnum.SUCCESS);}//失败的方法public static <T> Result<T> fail(T data) {return build(data, ResultCodeEnum.FAIL);}
}
  • ResultCodeEnum:返回结果
@Getter
public enum  ResultCodeEnum {SUCCESS(200,"成功"),FAIL(201, "失败"),;private Integer code;private String message;ResultCodeEnum(Integer code, String message) {this.code = code;this.message = message;}
}

2.1.3、实体

  • User
@Data
public class User {private String name;private Integer age;private Integer post;
}
  • ProductInfo:返回数据
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class ProductInfo implements Serializable {private Long id;/**销量*/private Integer sale;/**价格*/private Integer price;/**名称*/private String name;/**类型*/private Integer type;/**端口*/private Integer port;
}

2.1.4、Controller接口

@RestController
@RequestMapping("/productInfo/index")
public class ProductInfoController {@Resourceprivate ProductInfoService productInfoService;//    获取当前服务的端口@Value("${server.port}")private Integer port;@GetMapping("/get")public Result<?> get(Integer type){List<ProductInfo> productInfoList = getProductInfoList(type);System.out.println(productInfoList);return Result.ok(productInfoList);}@PostMapping("/post")public Result<?> post(@RequestBody User user){Integer post = user.getPost();List<ProductInfo> productInfoList = getProductInfoList(post);System.out.println(productInfoList);return Result.ok(productInfoList);}public List<ProductInfo> getProductInfoList(Integer type) {ProductInfo productInfo3 = new ProductInfo(3l,800,20,"哈密瓜1",1,port);ProductInfo productInfo1 = new ProductInfo(1l,50,8,"苹果1",1,port);ProductInfo productInfo2 = new ProductInfo(2l,200,13,"牛肉1",2,port);ProductInfo productInfo4 = new ProductInfo(4l,50,9,"青菜1",2,port);/*        实际项目中,会从数据库查出数据 */List<ProductInfo> productInfoList = Arrays.asList(productInfo1,productInfo2,productInfo3,productInfo4);//        根据传入的类型返回指定类型List<ProductInfo> result = productInfoList.stream().filter(productInfo -> productInfo.getType() == type).collect(Collectors.toList());return result;}
}

2.2、Apache HttpClient使用

  • get使用
    默认只能同步异步需要加额外的依赖,get请求不能携带参数,只能通过拼接路径
        <!--异步请求--><dependency><groupId>org.apache.httpcomponents</groupId><artifactId>httpasyncclient</artifactId></dependency>
    public static void get(CloseableHttpClient httpClient,String url){
//            连接对象try {
//        HttpGet不能携带参数,如果需要参数只能通过拼接HttpGet httpGet = new HttpGet(url+"?type=1");String execute = httpClient.execute(httpGet, response -> {JSONObject entries = new JSONObject(EntityUtils.toString(response.getEntity()));Result result = JSONUtil.toBean(entries, Result.class);if (result.getCode() == 200) {String data = result.getData().toString();System.out.println(data);return data;} else {System.err.println(result.getMessage());return result.getMessage();}});System.out.println("get成功结果:"+execute);} catch (Exception e) {e.printStackTrace();}}
  • post
    post请求,通过setEntity()给HttpPost对象添加请求对象
    public static void post(CloseableHttpClient httpClient,String url){HttpPost httpPost = new HttpPost(url);User user = new User();user.setPost(1);
//        添加参数对象httpPost.setEntity(new StringEntity(JSONUtil.toJsonStr(user)));// 设置请求头httpPost.setHeader(HttpHeaders.CONTENT_TYPE, "application/json");try {String execute = httpClient.execute(httpPost, response -> {JSONObject entries = new JSONObject(EntityUtils.toString(response.getEntity()));Result result = JSONUtil.toBean(entries, Result.class);if (result.getCode() == 200) {String data = result.getData().toString();log.info(data);return data;} else {log.error(result.getMessage());return result.getMessage();}});log.info("HttpClient的post成功结果:"+execute);} catch (IOException e) {e.printStackTrace();}}
  • 全部代码

执行步骤

  1. 创建CloseableHttpClient对象
  2. 创建get获取post请求对象
  3. 通过execute()方法发送请求
  4. 通过response.getEntity()获取响应回来的数据
@Slf4j
public class HttpClientUtil {private static String postUrl = "http://localhost:8202/productInfo/index/post";private static String getUrl = "http://localhost:8202/productInfo/index/get";public static void main(String[] args) {try {
//            创建客户端对象CloseableHttpClient client = HttpClients.createDefault();get(client,getUrl);post(client,postUrl);client.close();} catch (IOException e) {e.printStackTrace();}}public static void get(CloseableHttpClient httpClient,String url){
//            连接对象try {
//        HttpGet不能携带参数,如果需要参数只能通过拼接HttpGet httpGet = new HttpGet(url+"?type=1");String execute = httpClient.execute(httpGet, response -> {JSONObject entries = new JSONObject(EntityUtils.toString(response.getEntity()));Result result = JSONUtil.toBean(entries, Result.class);if (result.getCode() == 200) {String data = result.getData().toString();log.info(data);return data;} else {log.info(result.getMessage());return result.getMessage();}});log.info("HttpClient的get成功结果:"+execute);} catch (Exception e) {e.printStackTrace();}}public static void post(CloseableHttpClient httpClient,String url){HttpPost httpPost = new HttpPost(url);User user = new User();user.setPost(1);
//        添加参数对象httpPost.setEntity(new StringEntity(JSONUtil.toJsonStr(user)));// 设置请求头httpPost.setHeader(HttpHeaders.CONTENT_TYPE, "application/json");try {String execute = httpClient.execute(httpPost, response -> {JSONObject entries = new JSONObject(EntityUtils.toString(response.getEntity()));Result result = JSONUtil.toBean(entries, Result.class);if (result.getCode() == 200) {String data = result.getData().toString();log.info(data);return data;} else {log.error(result.getMessage());return result.getMessage();}});log.info("HttpClient的post成功结果:"+execute);} catch (IOException e) {e.printStackTrace();}}
}

2.3 、OkHttp使用

执行步骤

  1. 创建OkHttpClient对象,用于配置和管理HTTP请求的行为
  2. 创建Request对象,用于描述要发送的HTTP请求。Request对象包含了URL、请求方法、请求头、请求体等信息。
  3. 创建Call对象,使用OkHttpClient的newCall()方法,传入Request对象,创建一个Call对象,Call对象表示一次HTTP请求的调用,可以用于执行同步或异步的请求。
  4. 执行请求,同步通过Call对象的execute()方法来;异步通过Call对象的enqueue()方法来执行请求,并通过回调函数处理响应
  5. 解析响应,通过response.body()得到响应的内容在通过json解析。
@Slf4j
public class OkHttpUtil {private static String postUrl = "http://localhost:8202/productInfo/index/post";private static String getUrl = "http://localhost:8202/productInfo/index/get";public static void main(String[] args) {OkHttpClient client = new OkHttpClient().newBuilder().connectTimeout(30, TimeUnit.SECONDS) //连接超时时间.writeTimeout(30,TimeUnit.SECONDS)  //请求超时时间.readTimeout(30,TimeUnit.SECONDS)  //响应超时时间.build();
//        get(client);
//        asyncGet(client);
//        post(client);asyncPost(client);}/*** 同步get* @param client        * @return void*/public static void get(OkHttpClient client){
//        创建get请求对象Request request = new Request.Builder().url(getUrl+"?type=1").get().header("Content-Type", "application/json") // 设置Content-Type请求头.build();try {
//            返回响应对象Response response = client.newCall(request).execute();
//              验证响应是否成功if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
//              解码对象Result result = JSONUtil.toBean(response.body().string(), Result.class);Object data = result.getData();System.out.println(data);} catch (IOException e) {e.printStackTrace();}}/*** 异步get* @param client* @return void*/public static void asyncGet(OkHttpClient client){//        创建get请求对象Request request = new Request.Builder().url(getUrl+"?type=1").get()   //不指定请求方式默认是get.build();
//           异步发送请求,没有返回结果client.newCall(request).enqueue(new Callback() {//               处理失败请求@Overridepublic void onFailure(Call call, IOException e) {log.debug("Unexpected code " + e.getMessage());e.printStackTrace();}//            处理成功请求@Overridepublic void onResponse(Call call, Response response) throws IOException {
//              验证响应是否成功if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
//              解码对象Result result = JSONUtil.toBean(response.body().string(), Result.class);Object data = result.getData();System.out.println(data);}});}/*** 同步post* @param client* @return void*/public static void post(OkHttpClient client){User user = new User();user.setPost(1);String str = JSONUtil.toJsonStr(user);Request request = new Request.Builder().url(postUrl).post(RequestBody.create(MediaType.parse(ContentType.JSON.getValue()), str)).build();Call call = client.newCall(request);try {Response response = call.execute();//              验证响应是否成功if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
//              解码对象Result result = JSONUtil.toBean(response.body().string(), Result.class);Object data = result.getData();log.info("post请求成功,返回结果:{}",data);} catch (IOException e) {e.printStackTrace();}}/*** 异步post请求* @param client        * @return void*/public static void asyncPost(OkHttpClient client){User user = new User();user.setPost(1);
//          把对象转为json字符串String str = JSONUtil.toJsonStr(user);Request request = new Request.Builder().url(postUrl).post(RequestBody.create(MediaType.parse(ContentType.JSON.getValue()), str)).build();Call call = client.newCall(request);
//       异步请求没返回call.enqueue(new Callback() {
//            请求异常@Overridepublic void onFailure(Call call, IOException e) {log.debug("Unexpected code " + e.getMessage());e.printStackTrace();}
//            请求成功@Overridepublic void onResponse(Call call, Response response) throws IOException {//              验证响应是否成功if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
//              解码对象Result result = JSONUtil.toBean(response.body().string(), Result.class);Object data = result.getData();log.info("异步post请求成功,返回结果:{}",data);}});}
}

2.4、WebClient使用

执行步骤:

  1. 创建WebClient对象,推荐使用WebClient.builder()的方式创建,因为可以自定义配置客户端的参数,直接new是只能使用默认的配置。

  2. 构建请求,直接通过webClient对象,如get()、post()等,构建一个请求(如果没有指定请求方式),默认是get请求。

  3. 处理响应:使用响应对象(如Mono、Flux等)来处理响应数据。你可以通过操作符(如map()、flatMap()等)对响应进行转换、过滤、合并等操作。

  4. 订阅响应:使用subscribe()方法来订阅响应流,启动请求并处理响应数据。你可以通过回调函数或操作符链来处理响应数据。

@Component
@Slf4j
public class WebClientUtil {private static String postUrl = "http://localhost:8202/productInfo/index/post";private static String getUrl = "http://localhost:8202/productInfo/index/get";/*** 同步执行get请求* @param webClient* @return void*/public void get(WebClient webClient){Mono<Result> mono = webClient.get().uri(getUrl + "?type=2").retrieve().bodyToMono(Result.class);//        获取返回结果 block()会进行堵塞,等待返回结果Result result = mono.block();if (result.getCode()==200){log.info("get请求返回结果{}",result.getData());}}/*** 异步get* @return void*/public void asyncGet(){HttpClient client = HttpClient.create().option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 10000)  //设置连接超时.doOnConnected(conn -> conn.addHandler(new ReadTimeoutHandler(10, TimeUnit.SECONDS)) //写入超时.addHandler(new WriteTimeoutHandler(10))); //读取超时//        也可以以这种方式创建WebClient可以添加请求头和url以及一些参数;WebClient webClient = WebClient.builder().clientConnector(new ReactorClientHttpConnector(client)).baseUrl(getUrl).defaultHeader(HttpHeaders.USER_AGENT, "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko)")
//                .defaultCookie()  //添加请求Cookie.build();//        获取返回结果Mono<Result> mono = webClient.get().uri( "?type=2")// 请求路径,会拼接上面的.accept(MediaType.APPLICATION_JSON)//                .retrieve() //获取响应体
//                .bodyToMono(Result.class);  //指定获取的类型,直接获取结果。//                或者通过该方式手动处理结果.exchangeToMono(response->{if (response.statusCode().equals(HttpStatus.OK)) {
//                        成功返回return response.bodyToMono(Result.class);}else {
//                        失败返回return response.createException().flatMap(Mono::error);}});//        异步获取返回结果mono.subscribe(result -> {if (result.getCode() == 200) {log.info("get请求返回结果{}", result.getData());}});System.out.println("执行完成");}/*** 同步post* @return void*/public void post(){// 创建 WebClient 对象WebClient webClient = WebClient.builder().baseUrl(getUrl).build();User user = new User();user.setPost(2);Mono<Result> mono = webClient.post().uri(postUrl).contentType(MediaType.APPLICATION_JSON).header("token","12321412").body(BodyInserters.fromValue(user)).retrieve().bodyToMono(Result.class);Result result = mono.block();if (result.getCode()==200){log.info("post请求返回结果{}",result.getData());}}/*** WebClient异步请求* @return void*/public void asyncPost(){// 创建 WebClient 对象WebClient webClient = WebClient.builder().baseUrl(getUrl).build();User user = new User();user.setPost(2);Mono<Result> mono = webClient.post().uri(postUrl).contentType(MediaType.APPLICATION_JSON)  //指定类型.header("token","12321412")  //添加请求头.body(BodyInserters.fromValue(user)) //添加请求对象.retrieve().bodyToMono(Result.class);
//          异步请求mono.subscribe(result -> {if (result.getCode()==200){log.info("post异步请求返回结果{}",result.getData());}});}
}

相关文章:

【2023】java常用HTTP客户端对比以及使用(HttpClient/OkHttp/WebClient)

&#x1f4bb;目录 1、介绍2、使用2.1、添加配置2.1.1、依赖2.1.2、工具类2.1.3、实体2.1.4、Controller接口 2.2、Apache HttpClient使用2.3 、OkHttp使用2.4、WebClient使用 1、介绍 现在java使用的http客户端主要包括以下几种 而这些中使用得最频繁的主要是&#xff1a; A…...

微信小程序获取来源场景值

https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/scene.html#返回来源信息的场景 https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.getLaunchOptionsSync.html 场景值列表 只有1008是来源群聊 /** * 生命周期函数--监…...

Vue3:vue-cli项目创建及vue.config.js配置

一、node.js检测或安装&#xff1a; node -v node.js官方 二、vue-cli安装&#xff1a; npm install -g vue/cli # OR yarn global add vue/cli/*如果安装的时候报错&#xff0c;可以尝试一下方法 删除C:\Users**\AppData\Roaming下的npm和npm-cache文件夹 删除项目下的node…...

关于CAD导入**地球的一些问题讨论

先上示例: 上图是将北京王佐停车场的红线CAD图导入到图新地球效果,如果看官正是需要这样的效果,那么请你继续往下看,全是干货! 在地球中导入CAD图可以做为电子沙盘。对于工程人来说,是极有帮助的。以前一直用谷歌地球,大约在2020年左右,就被和谐了。当时感觉挺可惜的。…...

Semaphore信号量详解

在Java并发编程中&#xff0c;Semaphore是一个非常重要的工具类。它位于java.util.concurrent包中&#xff0c;为我们提供了一种限制对临界资源的访问的机制。你可以将其视为一个同步控制的瑞士军刀&#xff0c;因为它既能够控制对资源的并发访问数量&#xff0c;也能够保证资源…...

Python的核心知识点整理大全66(已完结撒花)

目录 D.3 忽略文件 .gitignore 注意 D.4 初始化仓库 D.5 检查状态 D.6 将文件加入到仓库中 D.7 执行提交 D.8 查看提交历史 D.9 第二次提交 hello_world.py D.10 撤销修改 hello_world.py 注意 D.11 检出以前的提交 往期快速传送门&#x1f446;&#xff08;在文…...

k8s的存储卷

存储卷------数据卷 把容器内的目录&#xff0c;和宿主机的目录进行挂载。 容器在系统上的生命周期是短暂的&#xff0c;delete&#xff0c;k8s用控制&#xff08;deployment&#xff09;创建的pod&#xff0c;delete相当于重启&#xff0c;容器的状态也会回复到初始状态。 …...

Git 实战指南:常用指令精要手册(持续更新)

&#x1f451;专栏内容&#xff1a;Git⛪个人主页&#xff1a;子夜的星的主页&#x1f495;座右铭&#xff1a;前路未远&#xff0c;步履不停 目录 一、Git 安装过程1、Windows 下安装2、Cent os 下安装3、Ubuntu 下安装 二、配置本地仓库1、 初始化 Git 仓库2、配置 name 和 e…...

关于SpringMVC前后端传值总结

一、传递方式 1、查询参数&路径参数 查询参数&#xff1a; URI:/teachers?typeweb GetMapping("/klasses/teachers") public List<Teacher> getKlassRelatedTeachers(String type ) { ... }如果查询参数type与方法的名称相同&#xff0c;则直接将web传入…...

【排序】归并排序(C语言实现)

文章目录 1. 递归版的归并排序1.1 归并排序的思想2. 递归版的归并排序的实现 2. 非递归版的归并排序 1. 递归版的归并排序 1.1 归并排序的思想 归并排序&#xff08;MERGE - SORT&#xff09;是建立在归并操作上的一种有效的排序算法, 该算法是采用分治法&#xff08;Divide a…...

127. 单词接龙

和433.最小基因变化这道题一样的解法。 https://blog.csdn.net/qq_43606119/article/details/135538247 class Solution {public int ladderLength(String beginWord, String endWord, List<String> wordList) {Set<String> cnt new HashSet<>();for (int …...

计算机算法贪心算法

贪心算法&#xff08;Greedy Algorithm&#xff09;是一种常见的算法思想&#xff0c;它在每一步选择当前状态下最优的解决方案&#xff0c;从而希望最终能够达到全局最优解。 贪心算法的基本思路是每一步都选择当前状态下的局部最优解&#xff0c;而忽略了当前选择所带来的影…...

基于css实现动画效果

介绍 本文将会基于css&#xff0c;实现各种动画效果&#xff0c;接下来会从简单几个例子入手。 案例 三颗球 <!DOCTYPE html> <html lang"en"><head><meta charset"utf-8" /><title>React App</title><style>…...

18.将文件上传至云服务器 + 优化网站的性能

目录 1.将文件上传至云服务器 1.1 处理上传头像逻辑 1.1.1 客户端上传 1.1.2 服务器直传 2.优化网站的性能 2.1 本地缓存优化查询方法 2.2 压力测试 1.将文件上传至云服务器 客户端上传&#xff1a;客户端将数据提交给云服务器&#xff0c;并等待其响应&#xff1b;用户…...

Linux: module: kheaders;CONFIG_IKHEADERS

文章目录 参考错误开一个玩笑。configcommit参考 https://github.com/iovisor/bcc/pull/2312 https://github.com/iovisor/bcc/pull/3588 https://bugs.gentoo.org/809347 https://lore.kernel.org/lkml/20190408212855.233198-1-joel@joelfernandes.org/ 错误 <built-in…...

Page 251~254 Win32 GUI项目

win32_gui 源代码&#xff1a; #if defined(UNICODE) && !defined(_UNICODE)#define _UNICODE #elif defined(_UNICODE) && !defined(UNICODE)#define UNICODE #endif#include <tchar.h> #include <windows.h>/* Declare Windows procedure */…...

Kafka(七)可靠性

目录 1 可靠的数据传递1.1 Kafka的可靠性保证1.2 复制1.3 Broker配置1.3.1 复制系数1.3.2 broker的位置分布1.3.3 不彻底的首领选举1.3.4 最少同步副本1.3.5 保持副本同步1.3.6 持久化到磁盘flush.messages9223372036854775807flush.ms9223372036854775807 1.2 在可靠的系统中使…...

Spring Data JPA入门到放弃

参考文档&#xff1a;SpringData JPA&#xff1a;一文带你搞懂 - 知乎 (zhihu.com) 一、 前言 1.1 概述 Java持久化技术是Java开发中的重要组成部分&#xff0c;它主要用于将对象数据持久化到数据库中&#xff0c;以及从数据库中查询和恢复对象数据。在Java持久化技术领域&a…...

MES系统数据采集的几种方式

生产制造执行MES系统具有能够帮助企业实现生产数据收集与分析、生产计划管理、生产过程监控等的功能板块&#xff0c;在这里小编就不一一介绍了&#xff0c;主要讲讲它的数据采集功能板块&#xff0c;可以说&#xff0c;数据采集是该系统进行数据统计与生产管理等后续工作的基础…...

铭文 LaunchPad 平台 Solmash 推出早鸟激励计划

为感谢用户对Solmash的支持&#xff0c;Solmash 特别推出“Solmash早鸟激励计划”&#xff0c;以回馈社区的早期参与者&#xff0c;这是专为已经参与Staking Pool或Honest Pool的用户推出的激励。 Solmash NFT激励 被列入早鸟计划的用户&#xff0c;可通过点击&#xff1a;sol…...

【前端规范】

1 前言 HTML 作为描述网页结构的超文本标记语言&#xff0c;一直有着广泛的应用。本文档的目标是使 HTML 代码风格保持一致&#xff0c;容易被理解和被维护。 2 代码风格 2.1 缩进与换行 [强制] 使用 4 个空格做为一个缩进层级&#xff0c;不允许使用 2 个空格 或 tab 字符…...

12、JVM高频面试题

1、JVM的主要组成部分有哪些 JVM主要分为下面几部分 类加载器&#xff1a;负责将字节码文件加载到内存中 运行时数据区&#xff1a;用于保存java程序运行过程中需要用到的数据和相关信息 执行引擎&#xff1a;字节码文件并不能直接交给底层操作系统去执行&#xff0c;因此需要…...

【Docker】Docker安装入门教程及基本使用

&#x1f389;&#x1f389;欢迎来到我的CSDN主页&#xff01;&#x1f389;&#x1f389; &#x1f3c5;我是Java方文山&#xff0c;一个在CSDN分享笔记的博主。&#x1f4da;&#x1f4da; &#x1f31f;推荐给大家我的专栏《Docker实战》。&#x1f3af;&#x1f3af; &…...

语义解析:如何基于SQL去实现自然语言与机器智能连接的桥梁

&#x1f308;个人主页: Aileen_0v0 &#x1f525;热门专栏: 华为鸿蒙系统学习|计算机网络|数据结构与算法 &#x1f4ab;个人格言:"没有罗马,那就自己创造罗马~" 目录 语义解析 定义 作用 语义解析的应用场景 场景一&#xff1a; 场景二&#xff1a; 总结语…...

Java项目:117SpringBoot动漫论坛网站

博主主页&#xff1a;Java旅途 简介&#xff1a;分享计算机知识、学习路线、系统源码及教程 文末获取源码 117SpringBoot动漫论坛网站 一、项目介绍 动漫论坛网站是由SpringBootMybatis开发的&#xff0c;旅游网站分为前台和后台&#xff0c;前台为用户浏览&#xff0c;后台进…...

Jenkins基础篇--添加节点

节点介绍 Jenkins 拥有分布式构建(在 Jenkins 的配置中叫做节点)&#xff0c;分布式构建能够让同一套代码在不同的环境(如&#xff1a;Windows 和 Linux 系统)中编译、测试等。 Jenkins 运行的主机在逻辑上是 master 节点&#xff0c;下图是主节点和从节点的关系。 添加节点 …...

【C++】手撕 list类(包含迭代器)

目录 1&#xff0c;list的介绍及使用 2&#xff0c;list_node 3&#xff0c;list_node() 3&#xff0c;list 4&#xff0c;list() 5&#xff0c;push_back(const T& x) 6&#xff0c;print() 7&#xff0c;_list_iterator 8&#xff0c;operator*() 9&#xff0c…...

@Autowired 和 @Resource 的区别是什么?

Java面试题目录 Autowired 和 Resource 的区别是什么&#xff1f; Autowired 是 Spring 提供的注解。默认的注入方式为byType&#xff08;根据类型进行匹配&#xff09;。 Resource 是 JDK 提供的注解。默认注入方式为 byName&#xff08;根据名称进行匹配&#xff09;。 当一…...

栈和排序.

给你一个1->n的排列和一个栈&#xff0c;入栈顺序给定 你要在不打乱入栈顺序的情况下&#xff0c;对数组进行从大到小排序 当无法完全排序时&#xff0c;请输出字典序最大的出栈序列 输入 第一行一个数n 第二行n个数&#xff0c;表示入栈的顺序&#xff0c;用空格隔开&…...

springboot 多数据源怎么配置在控制台的sql打印日志

程序员的公众号&#xff1a;源1024&#xff0c;获取更多资料&#xff0c;无加密无套路&#xff01; 最近整理了一波电子书籍资料&#xff0c;包含《Effective Java中文版 第2版》《深入JAVA虚拟机》&#xff0c;《重构改善既有代码设计》&#xff0c;《MySQL高性能-第3版》&…...