{"id":7762,"date":"2023-11-28T19:57:05","date_gmt":"2023-11-28T11:57:05","guid":{"rendered":"https:\/\/wx.kaifamiao.info\/?p=7762"},"modified":"2023-12-05T15:53:47","modified_gmt":"2023-12-05T07:53:47","slug":"springboot-de-yun-xing-you-na-ji-zhong-fang-shi","status":"publish","type":"post","link":"http:\/\/wx.kaifamiao.info\/index.php\/2023\/11\/28\/springboot-de-yun-xing-you-na-ji-zhong-fang-shi\/","title":{"rendered":"SpringBoot\u7684\u8fd0\u884c\u6709\u54ea\u51e0\u79cd\u65b9\u5f0f\uff1f"},"content":{"rendered":"<p>Spring Boot \u5e94\u7528\u7a0b\u5e8f\u53ef\u4ee5\u4ee5\u591a\u79cd\u65b9\u5f0f\u8fd0\u884c\uff0c\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u7684\u8fd0\u884c\u65b9\u5f0f\uff1a<\/p>\n<ol>\n<li>\n<strong>\u547d\u4ee4\u884c\u8fd0\u884c\uff1a<\/strong><\/p>\n<ul>\n<li>\u4f7f\u7528\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u901a\u8fc7\u6267\u884c <code>java -jar<\/code> \u547d\u4ee4\u8fd0\u884c\u6253\u5305\u597d\u7684\u53ef\u6267\u884c JAR \u6587\u4ef6\u3002<\/li>\n<li>\u793a\u4f8b\uff1a\n<pre><code class=\"language-bash\">java -jar myapp.jar\n<\/code><\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u4e2d\u8fd0\u884c\uff1a<\/strong><\/p>\n<ul>\n<li>\u5728\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08\u5982Eclipse\u3001IntelliJ IDEA\uff09\u4e2d\u76f4\u63a5\u8fd0\u884c Spring Boot \u5e94\u7528\u7a0b\u5e8f\u7684 <code>main<\/code> \u65b9\u6cd5\u3002<\/li>\n<li>\u5728 IDE \u4e2d\uff0c\u4f60\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u8fd0\u884c\/\u8c03\u8bd5\u914d\u7f6e\uff0c\u9009\u62e9\u4e3b\u7c7b\u5373\u53ef\u542f\u52a8\u5e94\u7528\u7a0b\u5e8f\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>Maven \u63d2\u4ef6\u8fd0\u884c\uff1a<\/strong><\/p>\n<ul>\n<li>\u4f7f\u7528 Maven \u63d2\u4ef6\u8fd0\u884c Spring Boot \u5e94\u7528\u7a0b\u5e8f\uff0c\u547d\u4ee4\u4e3a <code>mvn spring-boot:run<\/code>\u3002<\/li>\n<li>\u793a\u4f8b\uff1a\n<pre><code class=\"language-bash\">mvn spring-boot:run\n<\/code><\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>Gradle \u63d2\u4ef6\u8fd0\u884c\uff1a<\/strong><\/p>\n<ul>\n<li>\u4f7f\u7528 Gradle \u63d2\u4ef6\u8fd0\u884c Spring Boot \u5e94\u7528\u7a0b\u5e8f\uff0c\u547d\u4ee4\u4e3a <code>.\/gradlew bootRun<\/code>\u3002<\/li>\n<li>\u793a\u4f8b\uff1a\n<pre><code class=\"language-bash\">.\/gradlew bootRun\n<\/code><\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>Spring Boot Maven \u63d2\u4ef6\u8fd0\u884c\uff1a<\/strong><\/p>\n<ul>\n<li>\u5728 Maven \u9879\u76ee\u4e2d\uff0c\u901a\u8fc7 Spring Boot Maven \u63d2\u4ef6\u8fd0\u884c\u5e94\u7528\u7a0b\u5e8f\uff0c\u547d\u4ee4\u4e3a <code>mvn spring-boot:run<\/code>\u3002<\/li>\n<li>\u793a\u4f8b\uff1a\n<pre><code class=\"language-bash\">mvn spring-boot:run\n<\/code><\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>WAR \u6587\u4ef6\u90e8\u7f72\uff1a<\/strong><\/p>\n<ul>\n<li>\u5c06 Spring Boot \u5e94\u7528\u7a0b\u5e8f\u6253\u5305\u6210 WAR \u6587\u4ef6\uff0c\u7136\u540e\u90e8\u7f72\u5230\u5916\u90e8\u7684 Servlet \u5bb9\u5668\uff08\u5982 Tomcat\uff09\u4e2d\u8fd0\u884c\u3002<\/li>\n<li>\u793a\u4f8b\uff1a\n<pre><code class=\"language-bash\">java -jar myapp.war\n<\/code><\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>Docker \u5bb9\u5668\u8fd0\u884c\uff1a<\/strong><\/p>\n<ul>\n<li>\u5c06 Spring Boot \u5e94\u7528\u7a0b\u5e8f\u5bb9\u5668\u5316\uff0c\u5e76\u4f7f\u7528 Docker \u8fd0\u884c\u3002<\/li>\n<li>\u793a\u4f8b\uff1a\n<pre><code class=\"language-bash\">docker run -p 8080:8080 myapp\n<\/code><\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>Spring Boot CLI \u8fd0\u884c\uff1a<\/strong><\/p>\n<ul>\n<li>\u4f7f\u7528 Spring Boot CLI\uff08Command Line Interface\uff09\u8fd0\u884c Groovy \u811a\u672c\u6216 Spring Boot \u5e94\u7528\u7a0b\u5e8f\u3002<\/li>\n<li>\u793a\u4f8b\uff1a\n<pre><code class=\"language-bash\">spring run myscript.groovy\n<\/code><\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>\u8fd9\u4e9b\u8fd0\u884c\u65b9\u5f0f\u63d0\u4f9b\u4e86\u7075\u6d3b\u6027\u548c\u591a\u6837\u6027\uff0c\u5141\u8bb8\u5f00\u53d1\u8005\u6839\u636e\u5b9e\u9645\u9700\u6c42\u9009\u62e9\u6700\u9002\u5408\u7684\u65b9\u5f0f\u6765\u8fd0\u884c Spring Boot \u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Spring Boot \u5e94\u7528\u7a0b\u5e8f\u53ef\u4ee5\u4ee5\u591a\u79cd\u65b9\u5f0f\u8fd0\u884c\uff0c\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u7684\u8fd0\u884c\u65b9\u5f0f\uff1a \u547d\u4ee4\u884c\u8fd0\u884c\uff1a \u4f7f\u7528\u547d\u4ee4\u884c\u5de5\u5177\uff0c [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[100],"tags":[],"class_list":["post-7762","post","type-post","status-publish","format-standard","hentry","category-springboot"],"_links":{"self":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/7762","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/comments?post=7762"}],"version-history":[{"count":2,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/7762\/revisions"}],"predecessor-version":[{"id":16548,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/7762\/revisions\/16548"}],"wp:attachment":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/media?parent=7762"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/categories?post=7762"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/tags?post=7762"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}