{"id":6605,"date":"2025-09-30T11:55:00","date_gmt":"2025-09-30T03:55:00","guid":{"rendered":"https:\/\/xinchewhd.com.cn\/?p=6605"},"modified":"2025-09-29T11:56:03","modified_gmt":"2025-09-29T03:56:03","slug":"spring-boot-sshd-sftp%ef%bc%9assh-%e5%91%bd%e4%bb%a4%e4%b8%8e%e6%96%87%e4%bb%b6%e4%bc%a0%e8%be%93%e5%ae%9e%e8%b7%b5","status":"publish","type":"post","link":"https:\/\/xinchewhd.com.cn\/index.php\/spring-boot\/spring-boot-sshd-sftp%ef%bc%9assh-%e5%91%bd%e4%bb%a4%e4%b8%8e%e6%96%87%e4%bb%b6%e4%bc%a0%e8%be%93%e5%ae%9e%e8%b7%b5\/","title":{"rendered":"Spring Boot + sshd-sftp\uff1aSSH \u547d\u4ee4\u4e0e\u6587\u4ef6\u4f20\u8f93\u5b9e\u8df5"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\"><strong><\/strong><strong>\u524d\u8a00<\/strong><strong><\/strong><\/h2>\n\n\n\n<p>\u5728\u73b0\u4ee3\u5206\u5e03\u5f0f\u7cfb\u7edf\u4e2d\uff0c\u670d\u52a1\u5668\u95f4\u7684\u8fdc\u7a0b\u64cd\u4f5c\u4e0e\u6587\u4ef6\u4f20\u8f93\u662f\u5e38\u89c1\u9700\u6c42\u3002<code>SSH<\/code>\u4f5c\u4e3a\u4e00\u79cd\u5b89\u5168\u7684\u7f51\u7edc\u534f\u8bae\uff0c\u4e3a\u8fdc\u7a0b\u767b\u5f55\u548c\u6587\u4ef6\u4f20\u8f93\u63d0\u4f9b\u4e86\u53ef\u9760\u4fdd\u969c\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong><\/strong><strong>\u73af\u5883\u51c6\u5907<\/strong><\/h4>\n\n\n\n<p><code>sshd-sftp<\/code>\u662f<code>Apache MINA<\/code>\u9879\u76ee\u65d7\u4e0b\u7684<code>SSH<\/code>\u670d\u52a1\u5668\u7ec4\u4ef6\uff0c\u652f\u6301<code>SSHv2<\/code>\u534f\u8bae\uff0c\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684<code>API<\/code>\u7528\u4e8e\u6784\u5efa<code>SSH<\/code>\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\u3002\u76f8\u6bd4\u4f20\u7edf\u7684<code>JSch<\/code>\u5e93\uff0c<code>sshd-sftp<\/code>\u5177\u6709\u66f4\u6d3b\u8dc3\u7684\u793e\u533a\u7ef4\u62a4\u548c\u66f4\u5b8c\u5584\u7684\u529f\u80fd\u652f\u6301\uff0c\u5c24\u5176\u5728\u5904\u7406\u5927\u6587\u4ef6\u4f20\u8f93\u548c\u5e76\u53d1\u8fde\u63a5\u65f6\u8868\u73b0\u66f4\u4f18\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong><\/strong><strong>\u6848\u4f8b<\/strong><strong><\/strong><\/h2>\n\n\n\n<h4 class=\"wp-block-heading\"><strong><\/strong><strong>\u6548\u679c\u56fe<\/strong><\/h4>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" class=\"lazyload\"data-src=\"https:\/\/mmbiz.qpic.cn\/sz_mmbiz_gif\/QzI3807PeUkbBqC06uDAR9BaMyrxVezYdXlFtCmR0TNLdRavRRQ78bnicSbxvTfFtqEIiaRGaICILVeicbdsgdZUA\/640?wx_fmt=gif&amp;from=appmsg&amp;tp=wxpic&amp;wxfrom=5&amp;wx_lazy=1#imgIndex=1\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" alt=\"\u56fe\u7247\"\/><noscript><img decoding=\"async\" src=\"https:\/\/mmbiz.qpic.cn\/sz_mmbiz_gif\/QzI3807PeUkbBqC06uDAR9BaMyrxVezYdXlFtCmR0TNLdRavRRQ78bnicSbxvTfFtqEIiaRGaICILVeicbdsgdZUA\/640?wx_fmt=gif&amp;from=appmsg&amp;tp=wxpic&amp;wxfrom=5&amp;wx_lazy=1#imgIndex=1\" alt=\"\u56fe\u7247\"\/><\/noscript><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><strong><\/strong><strong>\u6838\u5fc3\u4f9d\u8d56<\/strong><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;dependency&gt;<br>&nbsp; &nbsp; &lt;groupId&gt;org.apache.sshd&lt;\/groupId&gt;<br>&nbsp; &nbsp; &lt;artifactId&gt;sshd-sftp&lt;\/artifactId&gt;<br>&nbsp; &nbsp; &lt;version&gt;2.10.0&lt;\/version&gt;<br>&lt;\/dependency&gt;<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\"><strong><\/strong><strong>SSH \u8fde\u63a5\u7ba1\u7406<\/strong><\/h4>\n\n\n\n<p>\u5efa\u7acb\u548c\u7ba1\u7406<code>SSH<\/code>\u8fde\u63a5\u662f\u6240\u6709\u64cd\u4f5c\u7684\u57fa\u7840\uff0c\u5408\u7406\u7684\u8fde\u63a5\u6c60\u8bbe\u8ba1\u80fd\u6709\u6548\u63d0\u5347\u7cfb\u7edf\u6027\u80fd\u3002<\/p>\n\n\n\n<h5 class=\"wp-block-heading\"><strong>\u521b\u5efaSshClientUtil\u5de5\u5177\u7c7b\u7ba1\u7406\u8fde\u63a5\u751f\u547d\u5468\u671f\uff1a<\/strong><\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>import lombok.extern.slf4j.Slf4j;<br>import org.apache.sshd.client.SshClient;<br>import org.apache.sshd.client.session.ClientSession;<br>import org.springframework.beans.factory.annotation.Value;<br>import org.springframework.stereotype.Component;<br><br>import java.io.IOException;<br><br>@Slf4j<br>@Component<br>public class SshClientUtil {<br>&nbsp; &nbsp; @Value(\"${ssh.host:182.168.1.101}\")<br>&nbsp; &nbsp; private String host;<br>&nbsp; &nbsp; @Value(\"${ssh.port:22}\")<br>&nbsp; &nbsp; private int port;<br>&nbsp; &nbsp; @Value(\"${ssh.username:root}\")<br>&nbsp; &nbsp; private String username;<br>&nbsp; &nbsp; @Value(\"${ssh.password:root}\")<br>&nbsp; &nbsp; private String password;<br>&nbsp; &nbsp; @Value(\"${ssh.timeout:5000}\")<br>&nbsp; &nbsp; private int timeout;<br><br>&nbsp; &nbsp; private SshClient client;<br>&nbsp; &nbsp; private ClientSession session;<br><br>&nbsp; &nbsp; \/**<br>&nbsp; &nbsp; &nbsp;* \u5efa\u7acbSSH\u8fde\u63a5<br>&nbsp; &nbsp; &nbsp;*\/<br>&nbsp; &nbsp; public void connect() throws IOException {<br>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;(session != null &amp;&amp; session.isOpen()) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;return;<br>&nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp; &nbsp; client = SshClient.setUpDefaultClient();<br>&nbsp; &nbsp; &nbsp; &nbsp; client.start();<br>&nbsp; &nbsp; &nbsp; &nbsp; session = client.connect(username, host, port)<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .verify(timeout)<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .getSession();<br><br>&nbsp; &nbsp; &nbsp; &nbsp; session.addPasswordIdentity(password);<br>&nbsp; &nbsp; &nbsp; &nbsp; session.auth().verify(timeout);<br>&nbsp; &nbsp; &nbsp; &nbsp; log.info(\"SSH\u8fde\u63a5\u6210\u529f\");<br>&nbsp; &nbsp; }<br><br>&nbsp; &nbsp; \/**<br>&nbsp; &nbsp; &nbsp;* \u65ad\u5f00SSH\u8fde\u63a5<br>&nbsp; &nbsp; &nbsp;*\/<br>&nbsp; &nbsp; public void disconnect() throws IOException {<br>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;(session != null &amp;&amp; session.isOpen()) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; session.close();<br>&nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;(client != null &amp;&amp; client.isStarted()) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; client.stop();<br>&nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; }<br><br>&nbsp; &nbsp; public ClientSession getSession() throws IOException {<br>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;(session == null || session.isEmpty() ||session.isClosed()) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; connect();<br>&nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;return&nbsp;session;<br>&nbsp; &nbsp; }<br>}<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\"><strong>\u8fdc\u7a0b\u547d\u4ee4\u6267\u884c<\/strong><\/h5>\n\n\n\n<p>\u901a\u8fc7<code>SSH<\/code>\u534f\u8bae\u6267\u884c\u8fdc\u7a0b\u547d\u4ee4\u662f\u670d\u52a1\u5668\u7ba1\u7406\u7684\u5e38\u7528\u529f\u80fd\uff0c\u9700\u8981\u5904\u7406\u547d\u4ee4\u8f93\u51fa\u548c\u9519\u8bef\u4fe1\u606f\u3002https:\/\/wxa.wxs.qq.com\/tmpl\/oc\/base_tmpl.html<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import org.apache.sshd.client.channel.ChannelExec;<br>import org.apache.sshd.client.channel.ClientChannelEvent;<br>import org.springframework.beans.factory.annotation.Autowired;<br>import org.springframework.beans.factory.annotation.Value;<br>import org.springframework.stereotype.Service;<br><br>import java.io.*;<br>import java.util.ArrayList;<br>import java.util.Arrays;<br>import java.util.List;<br><br>@Service<br>public class RemoteCommandService {<br>&nbsp; &nbsp; @Autowired<br>&nbsp; &nbsp; private SshClientUtil sshClientUtil;<br><br>&nbsp; &nbsp; @Value(\"${ssh.charset:UTF-8}\")<br>&nbsp; &nbsp; private String charset;<br><br>&nbsp; &nbsp; \/**<br>&nbsp; &nbsp; &nbsp;* \u6267\u884c\u5355\u6761SSH\u547d\u4ee4<br>&nbsp; &nbsp; &nbsp;*<br>&nbsp; &nbsp; &nbsp;* @param&nbsp;command&nbsp;\u547d\u4ee4\u5b57\u7b26\u4e32<br>&nbsp; &nbsp; &nbsp;* @return&nbsp;\u547d\u4ee4\u8f93\u51fa\u7ed3\u679c<br>&nbsp; &nbsp; &nbsp;*\/<br>&nbsp; &nbsp; public String executeCommand(String&nbsp;command) throws IOException {<br>&nbsp; &nbsp; &nbsp; &nbsp; try (ChannelExec channel = sshClientUtil.getSession().createExecChannel(command)) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ByteArrayOutputStream outputStream = new ByteArrayOutputStream();<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ByteArrayOutputStream errorStream = new ByteArrayOutputStream();<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; channel.setOut(outputStream);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; channel.setErr(errorStream);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; channel.open();<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; channel.waitFor(Arrays.asList(ClientChannelEvent.CLOSED), 0);<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int exitStatus = channel.getExitStatus();<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;(exitStatus != 0) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String errorMsg = new String(errorStream.toByteArray(), charset);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw new RuntimeException(\"\u547d\u4ee4\u6267\u884c\u5931\u8d25: \"&nbsp;+ errorMsg);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;return&nbsp;new String(outputStream.toByteArray(), charset);<br>&nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; }<br><br>&nbsp; &nbsp; \/**<br>&nbsp; &nbsp; &nbsp;* \u6267\u884c\u591a\u6761\u547d\u4ee4\uff08\u6309\u987a\u5e8f\u6267\u884c\uff09<br>&nbsp; &nbsp; &nbsp;*<br>&nbsp; &nbsp; &nbsp;* @param commands \u547d\u4ee4\u5217\u8868<br>&nbsp; &nbsp; &nbsp;* @return&nbsp;\u547d\u4ee4\u8f93\u51fa\u7ed3\u679c\u5217\u8868<br>&nbsp; &nbsp; &nbsp;*\/<br>&nbsp; &nbsp; public List&lt;String&gt; executeCommands(List&lt;String&gt; commands) throws IOException {<br>&nbsp; &nbsp; &nbsp; &nbsp; List&lt;String&gt; results = new ArrayList&lt;&gt;();<br>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;for&nbsp;(String cmd : commands) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; results.add(executeCommand(cmd));<br>&nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;return&nbsp;results;<br>&nbsp; &nbsp; }<br>}<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\"><strong>\u6587\u4ef6\u4e0a\u4f20\u4e0e\u4e0b\u8f7d<\/strong><\/h5>\n\n\n\n<p><code>SFTP<\/code>\u662f\u57fa\u4e8e<code>SSH<\/code>\u7684\u5b89\u5168\u6587\u4ef6\u4f20\u8f93\u534f\u8bae\uff0c\u76f8\u6bd4<code>FTP<\/code>\u5177\u6709\u66f4\u9ad8\u7684\u5b89\u5168\u6027\u3002https:\/\/wxa.wxs.qq.com\/tmpl\/oc\/base_tmpl.html<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import org.apache.sshd.sftp.client.SftpClient;<br>import org.apache.sshd.sftp.client.SftpClientFactory;<br>import org.apache.sshd.sftp.common.SftpException;<br>import org.springframework.beans.factory.annotation.Autowired;<br>import org.springframework.beans.factory.annotation.Value;<br>import org.springframework.stereotype.Service;<br><br>import java.io.*;<br>import java.nio.file.Files;<br>import java.nio.file.Path;<br>import java.nio.file.Paths;<br>import java.util.ArrayList;<br>import java.util.Arrays;<br>import java.util.List;<br><br>@Service<br>public class SftpFileService {<br>&nbsp; &nbsp; @Autowired<br>&nbsp; &nbsp; private SshClientUtil sshClientUtil;<br><br>&nbsp; &nbsp; @Value(\"${ssh.charset:UTF-8}\")<br>&nbsp; &nbsp; private String charset;<br><br><br>&nbsp; &nbsp; \/**<br>&nbsp; &nbsp; &nbsp;* \u4e0a\u4f20\u672c\u5730\u6587\u4ef6\u5230\u8fdc\u7a0b\u670d\u52a1\u5668<br>&nbsp; &nbsp; &nbsp;*<br>&nbsp; &nbsp; &nbsp;* @param localFilePath \u672c\u5730\u6587\u4ef6\u8def\u5f84<br>&nbsp; &nbsp; &nbsp;* @param remoteDir &nbsp; &nbsp; \u8fdc\u7a0b\u76ee\u5f55\u8def\u5f84<br>&nbsp; &nbsp; &nbsp;*\/<br>&nbsp; &nbsp; public void uploadFile(String localFilePath, String remoteDir) throws IOException {<br>&nbsp; &nbsp; &nbsp; &nbsp; try (SftpClient client = SftpClientFactory.instance().createSftpClient(sshClientUtil.getSession());<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SftpClient.CloseableHandle handle = client.open(remoteDir, SftpClient.OpenMode.Write, SftpClient.OpenMode.Create)) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/ \u4e0a\u4f20\u6587\u4ef6<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Path&nbsp;local&nbsp;= Paths.get(localFilePath);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; client.write(handle, 0, Files.readAllBytes(local));<br>&nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; }<br><br>&nbsp; &nbsp; \/**<br>&nbsp; &nbsp; &nbsp;* \u4ece\u8fdc\u7a0b\u670d\u52a1\u5668\u4e0b\u8f7d\u6587\u4ef6<br>&nbsp; &nbsp; &nbsp;*<br>&nbsp; &nbsp; &nbsp;* @param remoteFilePath \u8fdc\u7a0b\u6587\u4ef6\u8def\u5f84<br>&nbsp; &nbsp; &nbsp;* @param localDir &nbsp; &nbsp; &nbsp; \u672c\u5730\u76ee\u5f55\u8def\u5f84<br>&nbsp; &nbsp; &nbsp;*\/<br>&nbsp; &nbsp; public void downloadFile(String remoteFilePath, String localDir) throws IOException {<br>&nbsp; &nbsp; &nbsp; &nbsp; try (SftpClient client = SftpClientFactory.instance().createSftpClient(sshClientUtil.getSession());<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SftpClient.CloseableHandle handle = client.open(remoteFilePath, SftpClient.OpenMode.Read);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;OutputStream out = Files.newOutputStream(Paths.get(localDir))) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; long size = client.stat(handle).getSize();<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; byte&#91;] buffer = new byte&#91;8192];<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;for&nbsp;(long offset = 0; offset &lt; size; ) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int len = client.read(handle, offset, buffer, 0, buffer.length);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; out.write(buffer, 0, len);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; offset += len;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; }<br><br>&nbsp; &nbsp; \/**<br>&nbsp; &nbsp; &nbsp;* \u9012\u5f52\u521b\u5efa\u8fdc\u7a0b\u76ee\u5f55<br>&nbsp; &nbsp; &nbsp;*\/<br>&nbsp; &nbsp; private void mkdirs(SftpClient client, String dir) throws IOException {<br>&nbsp; &nbsp; &nbsp; &nbsp; String&#91;]&nbsp;dirs&nbsp;= dir.split(\"\/\");<br>&nbsp; &nbsp; &nbsp; &nbsp; String currentDir =&nbsp;\"\";<br>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;for&nbsp;(String d :&nbsp;dirs) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;(d.isEmpty())&nbsp;continue;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; currentDir +=&nbsp;\"\/\"&nbsp;+ d;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; client.stat(currentDir); \/\/ \u68c0\u67e5\u76ee\u5f55\u662f\u5426\u5b58\u5728<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } catch (IOException e) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; client.mkdir(currentDir); \/\/ \u4e0d\u5b58\u5728\u5219\u521b\u5efa<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; }<br>}<\/code><\/pre>\n","raw":"","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00 \u5728\u73b0\u4ee3\u5206\u5e03\u5f0f\u7cfb\u7edf\u4e2d\uff0c\u670d\u52a1\u5668\u95f4\u7684\u8fdc\u7a0b\u64cd\u4f5c\u4e0e\u6587\u4ef6\u4f20\u8f93\u662f\u5e38\u89c1\u9700\u6c42\u3002SSH\u4f5c\u4e3a\u4e00\u79cd\u5b89\u5168\u7684\u7f51\u7edc\u534f\u8bae\uff0c\u4e3a\u8fdc\u7a0b\u767b\u5f55\u548c\u6587\u4ef6\u4f20\u8f93\u63d0\u4f9b\u4e86\u53ef\u9760\u4fdd\u969c &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"emotion":"","emotion_color":"","title_style":"","license":"","footnotes":""},"categories":[7],"tags":[],"class_list":["post-6605","post","type-post","status-publish","format-standard","hentry","category-spring-boot"],"post_thumbnail_image":"https:\/\/mmbiz.qpic.cn\/sz_mmbiz_gif\/QzI3807PeUkbBqC06uDAR9BaMyrxVezYdXlFtCmR0TNLdRavRRQ78bnicSbxvTfFtqEIiaRGaICILVeicbdsgdZUA\/640?wx_fmt=gif&amp;from=appmsg&amp;tp=wxpic&amp;wxfrom=5&amp;wx_lazy=1#imgIndex=1","content_first_image":"https:\/\/mmbiz.qpic.cn\/sz_mmbiz_gif\/QzI3807PeUkbBqC06uDAR9BaMyrxVezYdXlFtCmR0TNLdRavRRQ78bnicSbxvTfFtqEIiaRGaICILVeicbdsgdZUA\/640?wx_fmt=gif&amp;from=appmsg&amp;tp=wxpic&amp;wxfrom=5&amp;wx_lazy=1#imgIndex=1","post_medium_image_300":"https:\/\/mmbiz.qpic.cn\/sz_mmbiz_gif\/QzI3807PeUkbBqC06uDAR9BaMyrxVezYdXlFtCmR0TNLdRavRRQ78bnicSbxvTfFtqEIiaRGaICILVeicbdsgdZUA\/640?wx_fmt=gif&amp;from=appmsg&amp;tp=wxpic&amp;wxfrom=5&amp;wx_lazy=1#imgIndex=1","post_thumbnail_image_624":"https:\/\/mmbiz.qpic.cn\/sz_mmbiz_gif\/QzI3807PeUkbBqC06uDAR9BaMyrxVezYdXlFtCmR0TNLdRavRRQ78bnicSbxvTfFtqEIiaRGaICILVeicbdsgdZUA\/640?wx_fmt=gif&amp;from=appmsg&amp;tp=wxpic&amp;wxfrom=5&amp;wx_lazy=1#imgIndex=1","post_frist_image":"https:\/\/mmbiz.qpic.cn\/sz_mmbiz_gif\/QzI3807PeUkbBqC06uDAR9BaMyrxVezYdXlFtCmR0TNLdRavRRQ78bnicSbxvTfFtqEIiaRGaICILVeicbdsgdZUA\/640?wx_fmt=gif&amp;from=appmsg&amp;tp=wxpic&amp;wxfrom=5&amp;wx_lazy=1#imgIndex=1","post_medium_image":"https:\/\/mmbiz.qpic.cn\/sz_mmbiz_gif\/QzI3807PeUkbBqC06uDAR9BaMyrxVezYdXlFtCmR0TNLdRavRRQ78bnicSbxvTfFtqEIiaRGaICILVeicbdsgdZUA\/640?wx_fmt=gif&amp;from=appmsg&amp;tp=wxpic&amp;wxfrom=5&amp;wx_lazy=1#imgIndex=1","post_large_image":"https:\/\/mmbiz.qpic.cn\/sz_mmbiz_gif\/QzI3807PeUkbBqC06uDAR9BaMyrxVezYdXlFtCmR0TNLdRavRRQ78bnicSbxvTfFtqEIiaRGaICILVeicbdsgdZUA\/640?wx_fmt=gif&amp;from=appmsg&amp;tp=wxpic&amp;wxfrom=5&amp;wx_lazy=1#imgIndex=1","post_full_image":"https:\/\/mmbiz.qpic.cn\/sz_mmbiz_gif\/QzI3807PeUkbBqC06uDAR9BaMyrxVezYdXlFtCmR0TNLdRavRRQ78bnicSbxvTfFtqEIiaRGaICILVeicbdsgdZUA\/640?wx_fmt=gif&amp;from=appmsg&amp;tp=wxpic&amp;wxfrom=5&amp;wx_lazy=1#imgIndex=1","post_all_images":[{"imagesurl":"https:\/\/mmbiz.qpic.cn\/sz_mmbiz_gif\/QzI3807PeUkbBqC06uDAR9BaMyrxVezYdXlFtCmR0TNLdRavRRQ78bnicSbxvTfFtqEIiaRGaICILVeicbdsgdZUA\/640?wx_fmt=gif&amp;from=appmsg&amp;tp=wxpic&amp;wxfrom=5&amp;wx_lazy=1#imgIndex=1","id":"image0"},{"imagesurl":"https:\/\/mmbiz.qpic.cn\/sz_mmbiz_gif\/QzI3807PeUkbBqC06uDAR9BaMyrxVezYdXlFtCmR0TNLdRavRRQ78bnicSbxvTfFtqEIiaRGaICILVeicbdsgdZUA\/640?wx_fmt=gif&amp;from=appmsg&amp;tp=wxpic&amp;wxfrom=5&amp;wx_lazy=1#imgIndex=1","id":"image1"}],"videoAdId":"","listAd":"0","listAdId":"","listAdEvery":6,"total_comments":0,"category_name":"Spring Boot","post_date":"2025-09-30","like_count":"0","praiseWord":"\u9f13\u52b1","copyright_state":"","excitationAd":"0","rewardedVideoAdId":"","detailAdId":"","detailAd":"0","enterpriseMinapp":"0","audios":[],"postImageUrl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230519082947553.jpg","avatarurls":[],"related_posts":null,"pageviews":345,"next_post_id":6607,"next_post_title":"SpringBoot+Redis\u81ea\u5b9a\u4e49\u6ce8\u89e3\u5b9e\u73b0\u53d1\u5e03\u8ba2\u9605","previous_post_id":6597,"previous_post_title":"\u6df1\u5165\u63a2\u7d22Java\u540e\u7aef\u5fae\u670d\u52a1\u67b6\u6784\u4e2d\u7684\u5206\u5e03\u5f0f\u4e8b\u52a1\u7ba1\u7406","_links":{"self":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/6605","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/comments?post=6605"}],"version-history":[{"count":1,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/6605\/revisions"}],"predecessor-version":[{"id":6606,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/6605\/revisions\/6606"}],"wp:attachment":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media?parent=6605"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/categories?post=6605"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/tags?post=6605"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}