{"id":24078,"date":"2025-04-19T09:21:24","date_gmt":"2025-04-19T01:21:24","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/24078.html"},"modified":"2025-04-19T09:21:24","modified_gmt":"2025-04-19T01:21:24","slug":"%e8%81%8a%e5%a4%a9%e6%9c%8d%e5%8a%a1%e5%99%a8%e5%88%86%e5%b8%83%e5%bc%8f%e6%94%b9%e9%80%a0","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/24078.html","title":{"rendered":"\u804a\u5929\u670d\u52a1\u5668\u5206\u5e03\u5f0f\u6539\u9020"},"content":{"rendered":"<p>\u76ee\u524d\u7684\u804a\u5929\u5ba4\u662f\u5355\u8282\u70b9\u7684&#xff0c;\u65e0\u8bba\u662fhttp\u63a5\u53e3\u8fd8\u662fsocket\u63a5\u53e3\u90fd\u5728\u540c\u4e00\u4e2a\u8fdb\u7a0b&#xff0c;\u65e0\u6cd5\u627f\u53d7\u592a\u591a\u4eba\u540c\u65f6\u5728\u7ebf&#xff0c;\u5bb9\u707e\u6027\u4e5f\u975e\u5e38\u5dee\u3002\u56e0\u6b64&#xff0c;\u4e00\u4e2a\u6210\u719f\u7684IM\u4ea7\u54c1\u4e00\u5b9a\u662f\u505a\u6210\u5206\u5e03\u5f0f\u7684&#xff0c;\u6839\u636e\u529f\u80fd\u5206\u6a21\u5757&#xff0c;\u6bcf\u4e2a\u6a21\u5757\u4e5f\u4f7f\u7528\u591a\u4e2a\u8282\u70b9\u5e76\u884c\u90e8\u7f72\u3002<\/p>\n<h2>1.\u6280\u672f\u9009\u578b<\/h2>\n<p>Spring Cloud Alibaba \u548c Netflix \u90fd\u662f\u7528\u4e8e\u6784\u5efa\u5206\u5e03\u5f0f\u7cfb\u7edf\u7684\u5de5\u5177\u96c6&#xff0c;\u5b83\u4eec\u5728\u5fae\u670d\u52a1\u67b6\u6784\u4e2d\u53d1\u6325\u7740\u91cd\u8981\u4f5c\u7528&#xff0c;\u4f46\u5728\u591a\u4e2a\u65b9\u9762\u5b58\u5728\u5dee\u5f02&#xff1a; \u53d1\u5c55\u4e0e\u7ef4\u62a4<\/p>\n<ul>\n<li>Netflix&#xff1a;\u90e8\u5206\u6838\u5fc3\u7ec4\u4ef6&#xff08;\u5982 Eureka\u3001Hystrix&#xff09;\u505c\u6b62\u66f4\u65b0\u7ef4\u62a4&#xff0c;\u4f01\u4e1a\u4f7f\u7528\u6709\u540e\u7eed\u98ce\u9669\u3002<\/li>\n<li>Spring Cloud Alibaba&#xff1a;\u7531\u963f\u91cc\u5df4\u5df4\u5f00\u6e90\u5e76\u6301\u7eed\u6295\u5165\u5f00\u53d1&#xff0c;\u793e\u533a\u6d3b\u8dc3&#xff0c;\u4e0d\u65ad\u8fed\u4ee3\u4f18\u5316&#xff0c;\u80fd\u53ca\u65f6\u4fee\u590d\u95ee\u9898\u3001\u6dfb\u52a0\u65b0\u529f\u80fd\u3002<\/li>\n<\/ul>\n<p>\u6838\u5fc3\u7ec4\u4ef6\u529f\u80fd<\/p>\n<ul>\n<li>Netflix \u670d\u52a1\u6ce8\u518c\u4e0e\u53d1\u73b0&#xff08;Eureka&#xff09;&#xff0c;\u8d1f\u8f7d\u5747\u8861&#xff08;Ribbon&#xff09;&#xff0c;\u7194\u65ad\u4e0e\u9650\u6d41&#xff08;Hystrix&#xff09;&#xff0c;\u90fd\u5df2\u7ecf\u505c\u66f4\u3002<\/li>\n<li>Spring Cloud Alibaba\u7684\u5404\u79cd\u7ec4\u4ef6\u5904\u4e8e\u6d3b\u8dc3\u7684\u5f00\u53d1\u548c\u7ef4\u62a4\u72b6\u6001&#xff0c;\u4e0d\u65ad\u63a8\u51fa\u65b0\u7684\u529f\u80fd\u548c\u4f18\u5316\u3002<\/li>\n<\/ul>\n<p>\u751f\u6001\u7cfb\u7edf<\/p>\n<ul>\n<li>Netflix&#xff1a;\u65e9\u671f\u751f\u6001\u5b8c\u6574&#xff0c;\u4f46\u56e0\u7ec4\u4ef6\u505c\u66f4\u53d1\u5c55\u53d7\u9650\u3002<\/li>\n<li>Spring Cloud Alibaba&#xff1a;\u6df1\u5ea6\u96c6\u6210 Spring Cloud&#xff0c;\u4e0e\u963f\u91cc\u5df4\u5df4\u5176\u4ed6\u5f00\u6e90\u9879\u76ee\u914d\u5408\u597d&#xff0c;\u793e\u533a\u6587\u6863\u548c\u793a\u4f8b\u4e30\u5bcc&#xff0c;\u751f\u6001\u53d1\u5c55\u597d\u3002<\/li>\n<\/ul>\n<p>\u7efc\u4e0a&#xff0c;\u6211\u4eec\u9009\u62e9Spring Cloud Alibaba&#xff08;2021.x \u7248\u672c&#xff09;\u3002<\/p>\n<h2>2.\u4e3b\u8981\u670d\u52a1\u7ec4\u4ef6<\/h2>\n<table border=\"1\" cellpadding=\"1\" cellspacing=\"1\" style=\"width:500px\">\n<tbody>\n<tr>\n<td>\u7ec4\u4ef6<\/td>\n<td>\u529f\u80fd\u00a0<\/td>\n<\/tr>\n<tr>\n<td>Nacos<\/td>\n<td>\u670d\u52a1\u6ce8\u518c\u4e0e\u53d1\u73b0\u7ec4\u4ef6&#xff0c;\u914d\u7f6e\u4e2d\u5fc3<\/td>\n<\/tr>\n<tr>\n<td> spring-cloud-starter-gateway <\/td>\n<td>\u901a\u4fe1\u7f51\u5173<\/td>\n<\/tr>\n<tr>\n<td>Spring Cloud Alibaba LoadBalancer<\/td>\n<td>\u5ba2\u6237\u7aef\u8d1f\u8f7d\u5747\u8861\u5668<\/td>\n<\/tr>\n<tr>\n<td> spring-security-oauth2 <\/td>\n<td>\u96c6\u4e2d\u6388\u6743\u4e2d\u5fc3<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>2.1.Nacos\u670d\u52a1\u53d1\u73b0\u4e0e\u914d\u7f6e\u7ba1\u7406<\/h3>\n<p>Nacos \u662f Spring Cloud Alibaba \u4e2d\u6838\u5fc3\u7684\u670d\u52a1\u6ce8\u518c\u4e0e\u53d1\u73b0\u7ec4\u4ef6&#xff0c;\u540c\u65f6\u4e5f\u5177\u5907\u914d\u7f6e\u7ba1\u7406\u529f\u80fd\u3002\u9664\u4e86Nacos&#xff0c;\u8fd8\u6709Eureka&#xff0c;Consul&#xff0c;ZooKeeper\u7b49\u6709\u7c7b\u4f3c\u529f\u80fd&#xff0c;\u4f46Nacos\u540c\u65f6\u5728\u8fd9\u4e24\u4e2a\u65b9\u9762\u8868\u73b0\u4f18\u5f02&#xff0c;\u8fd8\u6709\u4e00\u4e2a\u53ef\u89c6\u5316\u7ba1\u7406\u540e\u53f0&#xff0c;\u4f5c\u4e3a\u9996\u9009\u4ea7\u54c1\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"670\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419012122-6802fa92f26a8.png\" width=\"1464\" \/><\/p>\n<h3>2.2.spring-security-oauth2\u6388\u6743\u4e2d\u5fc3<\/h3>\n<p>spring-security-oauth2\u4f5c\u4e3a\u4e00\u4e2a\u96c6\u4e2d\u6388\u6743\u4e2d\u5fc3&#xff0c;\u65e0\u8bba\u662f\u5ba2\u6237\u7aef\u8bf7\u6c42&#xff0c;\u8fd8\u662f\u5fae\u670d\u52a1\u5185\u90e8\u7684\u8bf7\u6c42&#xff0c;\u90fd\u9700\u8981\u5148\u5230\u5b83\u8fd9\u91cc\u8fdb\u884c\u8ba4\u8bc1&#xff0c;\u7ed3\u5408jwt\u7b97\u6cd5&#xff0c;\u53ef\u4ee5\u751f\u6210\u4e00\u4e2a\u65e0\u9700\u670d\u52a1\u5668\u7ba1\u7406\u7684token\u3002<\/p>\n<p>Spring Security OAuth2 \u5b9e\u73b0\u4e86 OAuth 2.0 \u534f\u8bae\u4e2d\u7684\u56db\u79cd\u6388\u6743\u65b9\u5f0f&#xff0c;\u5206\u522b\u662f\u6388\u6743\u7801\u6a21\u5f0f&#xff08;Authorization Code&#xff09;\u3001\u7b80\u5316\u6a21\u5f0f&#xff08;Implicit&#xff09;\u3001\u5bc6\u7801\u6a21\u5f0f&#xff08;Resource Owner Password Credentials&#xff09;\u548c\u5ba2\u6237\u7aef\u6a21\u5f0f&#xff08;Client Credentials&#xff09;\u3002\u4e0b\u9762\u4e3a\u4f60\u8be6\u7ec6\u4ecb\u7ecd\u8fd9\u56db\u79cd\u6388\u6743\u65b9\u5f0f&#xff1a;<\/p>\n<p>\u6388\u6743\u7801\u6a21\u5f0f&#xff08;Authorization Code&#xff09;<\/p>\n<p>\u6388\u6743\u7801\u6a21\u5f0f\u662f OAuth 2.0 \u4e2d\u6700\u5b89\u5168\u3001\u6700\u5e38\u7528\u7684\u6388\u6743\u65b9\u5f0f\u3002\u5b83\u9002\u7528\u4e8e\u6709\u670d\u52a1\u5668\u7aef\u7684\u5e94\u7528&#xff0c;\u901a\u8fc7\u5ba2\u6237\u7aef\u5f15\u5bfc\u7528\u6237\u5230\u6388\u6743\u670d\u52a1\u5668\u8fdb\u884c\u767b\u5f55\u6388\u6743&#xff0c;\u83b7\u53d6\u6388\u6743\u7801&#xff0c;\u518d\u7528\u6388\u6743\u7801\u6362\u53d6\u8bbf\u95ee\u4ee4\u724c\u3002<\/p>\n<p>\u7b80\u5316\u6a21\u5f0f&#xff08;Implicit&#xff09;<\/p>\n<p>\u7b80\u5316\u6a21\u5f0f\u662f\u4e00\u79cd\u7b80\u5316\u7684\u6388\u6743\u65b9\u5f0f&#xff0c;\u9002\u7528\u4e8e\u6ca1\u6709\u670d\u52a1\u5668\u7aef\u7684\u5ba2\u6237\u7aef\u5e94\u7528&#xff08;\u5982\u5355\u9875\u5e94\u7528&#xff09;\u3002\u5b83\u7701\u7565\u4e86\u6388\u6743\u7801\u7684\u6b65\u9aa4&#xff0c;\u76f4\u63a5\u5728\u6d4f\u89c8\u5668\u4e2d\u83b7\u53d6\u8bbf\u95ee\u4ee4\u724c\u3002<\/p>\n<p>\u00a0\u5bc6\u7801\u6a21\u5f0f&#xff08;Resource Owner Password Credentials&#xff09;<\/p>\n<p>\u5bc6\u7801\u6a21\u5f0f\u662f\u4e00\u79cd\u7b80\u5355\u76f4\u63a5\u7684\u6388\u6743\u65b9\u5f0f&#xff0c;\u9002\u7528\u4e8e\u53d7\u4fe1\u4efb\u7684\u5ba2\u6237\u7aef\u5e94\u7528\u3002\u7528\u6237\u76f4\u63a5\u5c06\u81ea\u5df1\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\u63d0\u4f9b\u7ed9\u5ba2\u6237\u7aef&#xff0c;\u5ba2\u6237\u7aef\u4f7f\u7528\u8fd9\u4e9b\u4fe1\u606f\u5411\u6388\u6743\u670d\u52a1\u5668\u6362\u53d6\u8bbf\u95ee\u4ee4\u724c\u3002<\/p>\n<p>\u5ba2\u6237\u7aef\u6a21\u5f0f&#xff08;Client Credentials&#xff09;<\/p>\n<p>\u5ba2\u6237\u7aef\u6a21\u5f0f\u662f\u4e00\u79cd\u7528\u4e8e\u5ba2\u6237\u7aef\u5e94\u7528\u81ea\u8eab\u83b7\u53d6\u8bbf\u95ee\u4ee4\u724c\u7684\u6388\u6743\u65b9\u5f0f&#xff0c;\u4e0d\u6d89\u53ca\u7528\u6237\u7684\u8eab\u4efd\u4fe1\u606f\u3002\u9002\u7528\u4e8e\u5ba2\u6237\u7aef\u5e94\u7528\u9700\u8981\u4ee5\u81ea\u5df1\u7684\u8eab\u4efd\u8bbf\u95ee\u8d44\u6e90\u670d\u52a1\u5668\u7684\u573a\u666f\u3002<\/p>\n<p>\u5728<span style=\"color:#fe2c24\">\u5fae\u670d\u52a1\u5185\u90e8\u6388\u6743<\/span>\u4e0a&#xff0c;\u672c\u6587\u4f7f\u7528<span style=\"color:#fe2c24\">\u5ba2\u6237\u7aef\u6a21\u5f0f<\/span>\u3002\u5f53\u5fae\u670d\u52a1\u4e4b\u95f4\u4ee5\u670d\u52a1\u81ea\u8eab\u7684\u8eab\u4efd\u8fdb\u884c\u4ea4\u4e92&#xff0c;\u4e14\u4e0d\u9700\u8981\u533a\u5206\u7528\u6237\u8eab\u4efd\u65f6&#xff0c;\u5ba2\u6237\u7aef\u6a21\u5f0f\u662f\u4e00\u4e2a\u7b80\u5355\u3001\u5b89\u5168\u3001\u9ad8\u6548\u7684\u6388\u6743\u65b9\u5f0f\u3002\u53ef\u4ee5\u4f7f\u7528 OAuth 2.0 \u534f\u8bae\u7684\u5ba2\u6237\u7aef\u6a21\u5f0f\u6765\u7ba1\u7406\u670d\u52a1\u4e4b\u95f4\u7684\u8bbf\u95ee\u6743\u9650\u3002<\/p>\n<p>\u5728<span style=\"color:#fe2c24\">\u5ba2\u6237\u7aef\u767b\u5f55\u9a8c\u8bc1<\/span>\u4e0a&#xff0c;\u672c\u6587\u4f7f\u7528<span style=\"color:#fe2c24\">\u5bc6\u7801\u6a21\u5f0f<\/span>&#xff0c;\u7ed3\u5408<span style=\"color:#fe2c24\">jwt<\/span>\u7b97\u6cd5&#xff0c;\u5b9e\u73b0\u65e0\u72b6\u6001\u7684\u6388\u6743\u3002<\/p>\n<h2>3.\u6a21\u5757\u5212\u5206<\/h2>\n<p>\u5bf9\u4e8e\u4e00\u4e2a\u804a\u5929\u8f6f\u4ef6&#xff0c;\u6309\u7167\u529f\u80fd\u8fdb\u884c\u5212\u5206&#xff0c;\u5148\u7b80\u5355\u5212\u5206\u4e3a\u7528\u6237&#xff0c;web&#xff0c;socket\u6a21\u5757\u3002\u540e\u9762\u6839\u636e\u9700\u8981\u518d\u8fdb\u884c\u7ec6\u5316\u3002<\/p>\n<p>\u4e3b\u8981\u76ee\u6807&#xff0c;\u9664\u4e86\u804a\u5929\u8fd9\u79cd\u5b9e\u65f6\u6027\u8981\u6c42&#xff0c;\u4ee5\u53ca\u5ba2\u6237\u7aef\u63a8\u9001\u8fd9\u79cd\u9700\u8981\u670d\u52a1\u5668\u4e3b\u52a8\u53d1\u9001\u6d88\u606f\u4ee5\u5916&#xff0c;\u5176\u4ed6\u903b\u8f91\u5c3d\u53ef\u80fd\u8d70http&#xff0c;\u5b9e\u73b0\u8d1f\u8f7d\u5747\u8861\u3002 \u67b6\u6784\u56fe\u5982\u4e0b&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"690\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419012123-6802fa93522bd.png\" width=\"723\" \/><\/p>\n<p>\u5ba2\u6237\u7aef\u7edf\u4e00\u8bbf\u95eegateway\u7f51\u5173&#xff0c;\u901a\u8fc7\u8d26\u53f7\u5bc6\u7801\u5411\u6388\u6743\u4e2d\u5fc3\u8ba4\u8bc1\u901a\u8fc7\u540e&#xff0c;\u5f97\u5230\u4e00\u4e2atoken&#xff0c;\u540e\u7eed\u6240\u6709http\u8bf7\u6c42\u90fd\u9700\u8981\u5e26\u4e0a\u6b64header\u3002http\u767b\u5f55\u6210\u529f\u4e4b\u540e&#xff0c;\u670d\u52a1\u5668\u8fd8\u4f1a\u6839\u636e\u8d1f\u8f7d\u5747\u8861\u7b56\u7565\u9009\u62e9\u4e00\u4e2asocket\u8282\u70b9&#xff0c;\u4f5c\u4e3a\u5ba2\u6237\u7aef\u804a\u5929\u7684\u4e3b\u8981\u901a\u4fe1\u7f51\u5173&#xff0c;\u7528\u6237\u5728\u8fd9\u6b21\u767b\u5f55\u7684\u751f\u547d\u5468\u671f\u53ea\u4f1a\u7ed1\u5b9a\u8be5\u8282\u70b9&#xff0c;\u800c\u5176\u4ed6http\u8bf7\u6c42\u5219\u4f1a\u88ab\u5206\u6563\u5230\u4e0d\u540c\u6a21\u677f\u7684\u4e0d\u540c\u8282\u70b9\u3002<\/p>\n<h2>4.\u7b2c\u4e09\u65b9\u4e2d\u95f4\u4ef6<\/h2>\n<table border=\"1\" cellpadding=\"1\" cellspacing=\"1\" style=\"width:500px\">\n<tbody>\n<tr>\n<td>\u4e2d\u95f4\u4ef6<\/td>\n<td>\u4f5c\u7528<\/td>\n<\/tr>\n<tr>\n<td>mysql\u00a0<\/td>\n<td>\u7528\u6237&#xff0c;\u8ba8\u8bba\u7fa4&#xff0c;\u6d88\u606f\u7b49\u6570\u636e\u7684\u6301\u4e45\u5316\u65b9\u6848<\/td>\n<\/tr>\n<tr>\n<td>minio<\/td>\n<td>\u5934\u50cf&#xff0c;\u591a\u5a92\u4f53\u6d88\u606f\u7684\u6587\u4ef6\u5b58\u50a8\u7cfb\u7edf<\/td>\n<\/tr>\n<tr>\n<td>redis<\/td>\n<td>\u7528\u6237\u6570\u636e\u5feb\u901f\u7f13\u5b58<\/td>\n<\/tr>\n<tr>\n<td>nacos<\/td>\n<td>\u670d\u52a1\u6ce8\u518c\u53d1\u73b0&#xff0c;\u914d\u7f6e\u7ba1\u7406<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u7531\u4e8e\u4f7f\u7528\u7684\u4e2d\u95f4\u4ef6\u6bd4\u8f83\u591a&#xff0c;\u672c\u6587\u4f7f\u7528docker-compose\u8fdb\u884c\u96c6\u4e2d\u5316\u914d\u7f6e&#xff0c;\u914d\u7f6e\u5982\u4e0b&#xff1a;<\/p>\n<p>version: &#039;3.3&#039;<\/p>\n<p>services:<br \/>\n  db:<br \/>\n    image: mysql:latest<br \/>\n    container_name: im-mysql<br \/>\n    environment:<br \/>\n      MYSQL_PASSWORD: &#039;123456&#039;<br \/>\n      MYSQL_ROOT_PASSWORD: &#039;123456&#039;<br \/>\n    ports:<br \/>\n      &#8211; &#034;3306:3306&#034;<br \/>\n    volumes:<br \/>\n      &#8211; .\/data\/mysql\/data:\/var\/lib\/mysql<br \/>\n    restart: always<br \/>\n    networks:<br \/>\n      &#8211; im-network<br \/>\n  nacos:<br \/>\n    image: nacos\/nacos-server:v2.3.1<br \/>\n    container_name: im-nacos<br \/>\n    environment:<br \/>\n      &#8211; PREFER_HOST_MODE&#061;hostname<br \/>\n      &#8211; MODE&#061;standalone<br \/>\n      &#8211; NACOS_AUTH_IDENTITY_KEY&#061;serverIdentity<br \/>\n      &#8211; NACOS_AUTH_IDENTITY_VALUE&#061;security<br \/>\n      &#8211; NACOS_AUTH_TOKEN&#061;SecretKey012345678901234567890123456789012345678901234567890123456789<br \/>\n    ports:<br \/>\n      &#8211; &#034;8848:8848&#034;<br \/>\n      &#8211; &#034;9848:9848&#034;<br \/>\n    networks:<br \/>\n      &#8211; im-network <\/p>\n<p>  minio:<br \/>\n    image: minio\/minio:latest<br \/>\n    container_name: im-s3<br \/>\n    ports:<br \/>\n      &#8211; &#034;9000:9000&#034;<br \/>\n      &#8211; &#034;9001:9001&#034;<br \/>\n    environment:<br \/>\n      MINIO_ROOT_USER: minioadmin<br \/>\n      MINIO_ROOT_PASSWORD: minioadmin<br \/>\n    command: server &#8211;console-address &#034;:9001&#034; \/data<br \/>\n    volumes:<br \/>\n      &#8211; .\/data\/minio:\/data<br \/>\n    restart: always<br \/>\n    networks:<br \/>\n      &#8211; im-network<\/p>\n<p>  redis:<br \/>\n    image: redis:latest<br \/>\n    container_name: im-redis<br \/>\n    ports:<br \/>\n      &#8211; &#034;6379:6379&#034;<br \/>\n    volumes:<br \/>\n      &#8211; .\/data\/redis:\/data<br \/>\n    restart: always<br \/>\n    networks:<br \/>\n      &#8211; im-network<br \/>\nnetworks:<br \/>\n  im-network:<br \/>\n     driver: bridge<\/p>\n<p>\u00a0\u5168\u90e8\u4ee3\u7801\u5df2\u5728github\u4e0a\u6258\u7ba1<\/p>\n<p>\u670d\u52a1\u7aef\u4ee3\u7801\u8bf7\u79fb\u6b65 &#8211;&gt;\u00a0\u804a\u5929\u5ba4\u670d\u52a1\u5668<\/p>\n<p>\u5ba2\u6237\u7aef\u4ee3\u7801\u8bf7\u79fb\u6b65 &#8211;&gt;\u00a0\u804a\u5929\u5ba4\u5ba2\u6237\u7aef<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.9k\u6b21\uff0c\u70b9\u8d5e46\u6b21\uff0c\u6536\u85cf39\u6b21\u3002\u76ee\u524d\u7684\u804a\u5929\u5ba4\u662f\u5355\u8282\u70b9\u7684\uff0c\u65e0\u8bba\u662fhttp\u63a5\u53e3\u8fd8\u662fsocket\u63a5\u53e3\u90fd\u5728\u540c\u4e00\u4e2a\u8fdb\u7a0b\uff0c\u65e0\u6cd5\u627f\u53d7\u592a\u591a\u4eba\u540c\u65f6\u5728\u7ebf\uff0c\u5bb9\u707e\u6027\u4e5f\u975e\u5e38\u5dee\u3002\u672c\u6587\u8bb2\u8ff0\u5982\u4f55\u5bf9\u8be5\u804a\u5929\u5ba4\u8fdb\u884c\u5206\u5e03\u5f0f\u6539\u9020\u7684\u76ee\u6807\u548c\u5b9e\u73b0\u65b9\u5f0f\u3002<\/p>\n","protected":false},"author":2,"featured_media":24076,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[1848,963,664,1847,1849],"topic":[],"class_list":["post-24078","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-qq","tag-spring-cloud","tag-664","tag-netty","tag-1849"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u804a\u5929\u670d\u52a1\u5668\u5206\u5e03\u5f0f\u6539\u9020 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/24078.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u804a\u5929\u670d\u52a1\u5668\u5206\u5e03\u5f0f\u6539\u9020 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.9k\u6b21\uff0c\u70b9\u8d5e46\u6b21\uff0c\u6536\u85cf39\u6b21\u3002\u76ee\u524d\u7684\u804a\u5929\u5ba4\u662f\u5355\u8282\u70b9\u7684\uff0c\u65e0\u8bba\u662fhttp\u63a5\u53e3\u8fd8\u662fsocket\u63a5\u53e3\u90fd\u5728\u540c\u4e00\u4e2a\u8fdb\u7a0b\uff0c\u65e0\u6cd5\u627f\u53d7\u592a\u591a\u4eba\u540c\u65f6\u5728\u7ebf\uff0c\u5bb9\u707e\u6027\u4e5f\u975e\u5e38\u5dee\u3002\u672c\u6587\u8bb2\u8ff0\u5982\u4f55\u5bf9\u8be5\u804a\u5929\u5ba4\u8fdb\u884c\u5206\u5e03\u5f0f\u6539\u9020\u7684\u76ee\u6807\u548c\u5b9e\u73b0\u65b9\u5f0f\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/24078.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-19T01:21:24+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419012122-6802fa92f26a8.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/24078.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/24078.html\",\"name\":\"\u804a\u5929\u670d\u52a1\u5668\u5206\u5e03\u5f0f\u6539\u9020 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-19T01:21:24+00:00\",\"dateModified\":\"2025-04-19T01:21:24+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/24078.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/24078.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/24078.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u804a\u5929\u670d\u52a1\u5668\u5206\u5e03\u5f0f\u6539\u9020\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u804a\u5929\u670d\u52a1\u5668\u5206\u5e03\u5f0f\u6539\u9020 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/24078.html","og_locale":"zh_CN","og_type":"article","og_title":"\u804a\u5929\u670d\u52a1\u5668\u5206\u5e03\u5f0f\u6539\u9020 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.9k\u6b21\uff0c\u70b9\u8d5e46\u6b21\uff0c\u6536\u85cf39\u6b21\u3002\u76ee\u524d\u7684\u804a\u5929\u5ba4\u662f\u5355\u8282\u70b9\u7684\uff0c\u65e0\u8bba\u662fhttp\u63a5\u53e3\u8fd8\u662fsocket\u63a5\u53e3\u90fd\u5728\u540c\u4e00\u4e2a\u8fdb\u7a0b\uff0c\u65e0\u6cd5\u627f\u53d7\u592a\u591a\u4eba\u540c\u65f6\u5728\u7ebf\uff0c\u5bb9\u707e\u6027\u4e5f\u975e\u5e38\u5dee\u3002\u672c\u6587\u8bb2\u8ff0\u5982\u4f55\u5bf9\u8be5\u804a\u5929\u5ba4\u8fdb\u884c\u5206\u5e03\u5f0f\u6539\u9020\u7684\u76ee\u6807\u548c\u5b9e\u73b0\u65b9\u5f0f\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/24078.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-19T01:21:24+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419012122-6802fa92f26a8.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/24078.html","url":"https:\/\/www.wsisp.com\/helps\/24078.html","name":"\u804a\u5929\u670d\u52a1\u5668\u5206\u5e03\u5f0f\u6539\u9020 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-19T01:21:24+00:00","dateModified":"2025-04-19T01:21:24+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/24078.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/24078.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/24078.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u804a\u5929\u670d\u52a1\u5668\u5206\u5e03\u5f0f\u6539\u9020"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/24078","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=24078"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/24078\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/24076"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=24078"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=24078"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=24078"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=24078"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}