{"id":4348,"date":"2021-12-03T17:01:35","date_gmt":"2021-12-03T09:01:35","guid":{"rendered":"http:\/\/123.57.164.21\/?p=4348"},"modified":"2021-12-03T17:01:35","modified_gmt":"2021-12-03T09:01:35","slug":"spring-boot%e9%85%8d%e7%bd%ae%e5%8a%a0%e8%bd%bd%e9%a1%ba%e5%ba%8f","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=4348","title":{"rendered":"Spring Boot\u914d\u7f6e\u52a0\u8f7d\u987a\u5e8f"},"content":{"rendered":"\n<p>Spring Boot \u4e0d\u4ec5\u53ef\u4ee5\u901a\u8fc7\u914d\u7f6e\u6587\u4ef6\u8fdb\u884c\u914d\u7f6e\uff0c\u8fd8\u53ef\u4ee5\u901a\u8fc7\u73af\u5883\u53d8\u91cf\u3001\u547d\u4ee4\u884c\u53c2\u6570\u7b49\u591a\u79cd\u5f62\u5f0f\u8fdb\u884c\u914d\u7f6e\u3002\u8fd9\u4e9b\u914d\u7f6e\u90fd\u53ef\u4ee5\u8ba9\u5f00\u53d1\u4eba\u5458\u5728\u4e0d\u4fee\u6539\u4efb\u4f55\u4ee3\u7801\u7684\u524d\u63d0\u4e0b\uff0c\u76f4\u63a5\u5c06\u4e00\u5957 Spring Boot&nbsp; \u5e94\u7528\u7a0b\u5e8f\u5728\u4e0d\u540c\u7684\u73af\u5883\u4e2d\u8fd0\u884c\u3002<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Spring Boot \u914d\u7f6e\u4f18\u5148\u7ea7<\/h5>\n\n\n\n<p>\u4ee5\u4e0b\u662f\u5e38\u7528\u7684 Spring Boot \u914d\u7f6e\u5f62\u5f0f\u53ca\u5176\u52a0\u8f7d\u987a\u5e8f\uff08\u4f18\u5148\u7ea7\u7531\u9ad8\u5230\u4f4e\uff09\uff1a<\/p>\n\n\n\n<ol><li>\u547d\u4ee4\u884c\u53c2\u6570<\/li><li>\u6765\u81ea java:comp\/env \u7684 JNDI \u5c5e\u6027<\/li><li>Java \u7cfb\u7edf\u5c5e\u6027\uff08System.getProperties()\uff09<\/li><li>\u64cd\u4f5c\u7cfb\u7edf\u73af\u5883\u53d8\u91cf<\/li><li>RandomValuePropertySource \u914d\u7f6e\u7684 random.* \u5c5e\u6027\u503c<\/li><li>\u914d\u7f6e\u6587\u4ef6\uff08YAML \u6587\u4ef6\u3001Properties \u6587\u4ef6\uff09<\/li><li>@Configuration \u6ce8\u89e3\u7c7b\u4e0a\u7684 @PropertySource \u6307\u5b9a\u7684\u914d\u7f6e\u6587\u4ef6<\/li><li>\u901a\u8fc7 SpringApplication.setDefaultProperties \u6307\u5b9a\u7684\u9ed8\u8ba4\u5c5e\u6027<\/li><\/ol>\n\n\n\n<p>\u4ee5\u4e0a\u6240\u6709\u5f62\u5f0f\u7684\u914d\u7f6e\u90fd\u4f1a\u88ab\u52a0\u8f7d\uff0c\u5f53\u5b58\u5728\u76f8\u540c\u914d\u7f6e\u5185\u5bb9\u65f6\uff0c\u9ad8\u4f18\u5148\u7ea7\u7684\u914d\u7f6e\u4f1a\u8986\u76d6\u4f4e\u4f18\u5148\u7ea7\u7684\u914d\u7f6e\uff1b\u5b58\u5728\u4e0d\u540c\u7684\u914d\u7f6e\u5185\u5bb9\u65f6\uff0c\u9ad8\u4f18\u5148\u7ea7\u548c\u4f4e\u4f18\u5148\u7ea7\u7684\u914d\u7f6e\u5185\u5bb9\u53d6\u5e76\u96c6\uff0c\u5171\u540c\u751f\u6548\uff0c\u5f62\u6210\u4e92\u8865\u914d\u7f6e\u3002<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">\u547d\u4ee4\u884c\u53c2\u6570<\/h5>\n\n\n\n<p>Spring Boot \u4e2d\u7684\u6240\u6709\u914d\u7f6e\uff0c\u90fd\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u53c2\u6570\u8fdb\u884c\u6307\u5b9a\uff0c\u5176\u914d\u7f6e\u5f62\u5f0f\u5982\u4e0b\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">java -jar {Jar\u6587\u4ef6\u540d} --{\u53c2\u65701}={\u53c2\u6570\u503c1} --{\u53c2\u65702}={\u53c2\u6570\u503c2}\n<\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">\u793a\u4f8b 1<\/h5>\n\n\n\n<p>1. \u5728 springbootdemo\u00a0 \u9879\u76ee\u542f\u52a8\u65f6\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">java -jar springbootdemo-0.0.1-SNAPSHOT.jar --server.port=8081 --server.servlet.context-path=\/bcb\n<\/pre>\n\n\n\n<p>\u547d\u4ee4\u884c\u53c2\u6570\u8bf4\u660e\u5982\u4e0b\uff1a<\/p>\n\n\n\n<ul><li>&#8211;server.port\uff1a\u6307\u5b9a\u670d\u52a1\u5668\u7aef\u53e3\u53f7\uff1b<\/li><li>&#8211;server.servlet.context-path\uff1a\u6307\u5b9a\u4e0a\u4e0b\u6587\u8def\u5f84\uff08\u9879\u76ee\u7684\u8bbf\u95ee\u8def\u5f84\uff09\u3002<\/li><\/ul>\n\n\n\n<p>\u6267\u884c\u7ed3\u679c\u5982\u4e0b\u56fe\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2021\/12\/image-88-1024x366.png\" alt=\"\" class=\"wp-image-4350\" width=\"718\" height=\"256\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-88-1024x366.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-88-300x107.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-88-768x275.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-88-1536x549.png 1536w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-88-830x297.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-88-230x82.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-88-350x125.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-88-480x172.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-88.png 1790w\" sizes=\"(max-width: 718px) 100vw, 718px\" \/><\/figure><\/div>\n\n\n\n<h5 class=\"wp-block-heading\">\u914d\u7f6e\u6587\u4ef6<\/h5>\n\n\n\n<p>Spring Boot \u542f\u52a8\u65f6\uff0c\u4f1a\u81ea\u52a8\u52a0\u8f7d JAR \u5305\u5185\u90e8\u53ca JAR \u5305\u6240\u5728\u76ee\u5f55\u6307\u5b9a\u4f4d\u7f6e\u7684\u914d\u7f6e\u6587\u4ef6\uff08Properties \u6587\u4ef6\u3001YAML \u6587\u4ef6\uff09\uff0c\u4e0b\u56fe\u4e2d\u5c55\u793a\u4e86 Spring Boot \u81ea\u52a8\u52a0\u8f7d\u7684\u914d\u7f6e\u6587\u4ef6\u7684\u4f4d\u7f6e\u53ca\u5176\u52a0\u8f7d\u987a\u5e8f\uff0c\u540c\u4e00\u4f4d\u7f6e\u4e0b\uff0cProperties \u6587\u4ef6\u4f18\u5148\u7ea7\u9ad8\u4e8e YAML \u6587\u4ef6\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2021\/12\/image-89-1024x1022.png\" alt=\"\" class=\"wp-image-4352\" width=\"606\" height=\"605\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-89-1024x1022.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-89-300x300.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-89-150x150.png 150w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-89-768x767.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-89-830x829.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-89-230x230.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-89-350x349.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-89-480x479.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-89.png 1218w\" sizes=\"(max-width: 606px) 100vw, 606px\" \/><\/figure><\/div>\n\n\n\n<p>\u56fe 2 \u8bf4\u660e\u5982\u4e0b\uff1a<\/p>\n\n\n\n<ul><li>\/myBoot\uff1a\u8868\u793a JAR \u5305\u6240\u5728\u76ee\u5f55\uff0c\u76ee\u5f55\u540d\u79f0\u81ea\u5b9a\u4e49\uff1b<\/li><li>\/childDir\uff1a\u8868\u793a JAR \u5305\u6240\u5728\u76ee\u5f55\u4e0b config \u76ee\u5f55\u7684\u5b50\u76ee\u5f55\uff0c\u76ee\u5f55\u540d\u81ea\u5b9a\u4e49\uff1b<\/li><li>JAR\uff1a\u8868\u793a Spring Boot \u9879\u76ee\u6253\u5305\u751f\u6210\u7684 JAR\uff1b<\/li><li>\u5176\u4f59\u5e26\u6709\u201c\/\u201d\u6807\u8bc6\u7684\u76ee\u5f55\u7684\u76ee\u5f55\u540d\u79f0\u5747\u4e0d\u80fd\u4fee\u6539\u3002<\/li><li>\u7ea2\u8272\u6570\u5b57\uff1a\u8868\u793a\u8be5\u914d\u7f6e\u6587\u4ef6\u7684\u4f18\u5148\u7ea7\uff0c\u6570\u5b57\u8d8a\u5c0f\u4f18\u5148\u7ea7\u8d8a\u9ad8\u3002<\/li><\/ul>\n\n\n\n<p>\u8fd9\u4e9b\u914d\u7f6e\u6587\u4ef6\u5f97\u4f18\u5148\u7ea7\u987a\u5e8f\uff0c\u9075\u5faa\u4ee5\u4e0b\u89c4\u5219\uff1a<\/p>\n\n\n\n<ol><li>\u5148\u52a0\u8f7d JAR \u5305\u5916\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u518d\u52a0\u8f7d JAR \u5305\u5185\u7684\u914d\u7f6e\u6587\u4ef6\uff1b<\/li><li>\u5148\u52a0\u8f7d config \u76ee\u5f55\u5185\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u518d\u52a0\u8f7d config \u76ee\u5f55\u5916\u7684\u914d\u7f6e\u6587\u4ef6\uff1b<\/li><li>\u5148\u52a0\u8f7d config \u5b50\u76ee\u5f55\u4e0b\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u518d\u52a0\u8f7d config \u76ee\u5f55\u4e0b\u7684\u914d\u7f6e\u6587\u4ef6\uff1b<\/li><li>\u5148\u52a0\u8f7d appliction-{profile}.properties\/yml\uff0c\u518d\u52a0\u8f7d application.properties\/yml\uff1b<\/li><li>\u5148\u52a0\u8f7d .properties \u6587\u4ef6\uff0c\u518d\u52a0\u8f7d .yml \u6587\u4ef6\u3002<\/li><\/ol>\n\n\n\n<h5 class=\"wp-block-heading\">\u793a\u4f8b 2<\/h5>\n\n\n\n<p>1. \u521b\u5efa\u4e00\u4e2a\u540d\u4e3a mybootdemo \u7684 Spring Boot \u9879\u76ee\uff0c\u5e76\u5728 src\/main\/resoources \u4e0b\u521b\u5efa\u4ee5\u4e0b 4 \u4e2a\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n\n\n\n<ul><li>application.yml\uff1a\u9ed8\u8ba4\u914d\u7f6e<\/li><li>application-dev.yml\uff1a\u5f00\u53d1\u73af\u5883\u914d\u7f6e<\/li><li>application-test.yml\uff1a\u6d4b\u8bd5\u73af\u5883\u914d\u7f6e<\/li><li>application-prod.yml\uff1a\u751f\u4ea7\u73af\u5883\u914d\u7f6e<\/li><\/ul>\n\n\n\n<p>1\uff09\u5728 applcation.yml \u6587\u4ef6\u4e2d\uff0c\u6307\u5b9a\u9ed8\u8ba4\u670d\u52a1\u7aef\u53e3\u53f7\uff08port\uff09\u4e3a \u201c8080\u201d\uff0c\u4e0a\u4e0b\u6587\u8def\u5f84\uff08context-path\uff09\u4e3a\u201c\/mybootdemo\u201d\uff0c\u5e76\u6fc0\u6d3b\u5f00\u53d1\u73af\u5883\uff08dev\uff09\u7684 profile\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">server:\n  port: 8080 #\u7aef\u53e3\u53f7\n  servlet:\n    context-path: \/mybootdemo #\u4e0a\u4e0b\u6587\u8def\u5f84\u6216\u9879\u76ee\u8bbf\u95ee\u8def\u5f84\nspring:\n  profiles:\n    active: dev #\u6fc0\u6d3b\u5f00\u53d1\u73af\u5883\u914d\u7f6e\n<\/pre>\n\n\n\n<p>2\uff09\u5728 application-dev.yml \u4e2d\uff0c\u6307\u5b9a\u5f00\u53d1\u73af\u5883\u7aef\u53e3\u53f7\u4e3a \u201c8081\u201d\uff0c\u4e0a\u4e0b\u6587\u8def\u5f84\u4e3a\u201c\/in-dev\u201d\uff0c\u914d\u7f6e\u5982\u4e0b\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">server:\n  port: 8081 #\u5f00\u53d1\u73af\u5883\u7aef\u53e3\u53f7 8081\n  servlet:\n    context-path: \/in-dev #\u5f00\u53d1\u73af\u5883\u4e0a\u4e0b\u6587\u8def\u5f84\u4e3a in-dev\nspring:\n  config:\n    activate:\n      on-profile: dev #\u5f00\u53d1\u73af\u5883\n<\/pre>\n\n\n\n<p>3\uff09\u5728 application-test.yml \u4e2d\uff0c\u6307\u5b9a\u6d4b\u8bd5\u73af\u5883\u7aef\u53e3\u53f7\u4e3a \u201c8082\u201d\uff0c\u4e0a\u4e0b\u6587\u8def\u5f84\u4e3a\u201c\/in-test\u201d\uff0c\u914d\u7f6e\u5982\u4e0b\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">#\u6d4b\u8bd5\u73af\u5883\u914d\u7f6e\nserver:\n  port: 8082 #\u6d4b\u8bd5\u73af\u5883\u7aef\u53e3 8082\n  servlet:\n    context-path: \/in-test #\u6d4b\u8bd5\u73af\u5883\u4e0a\u4e0b\u6587\u8def\u5f84 \/in-test\nspring:\n  config:\n    activate:\n      on-profile: test\n<\/pre>\n\n\n\n<p>4\uff09\u5728 application-prod.yml \u4e2d\uff0c\u6307\u5b9a\u751f\u4ea7\u73af\u5883\u7aef\u53e3\u53f7\u4e3a \u201c8083\u201d\uff0c\u4e0a\u4e0b\u6587\u8def\u5f84\u4e3a\u201c\/in-prod\u201d\uff0c\u914d\u7f6e\u5982\u4e0b\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">#\u751f\u4ea7\u73af\u5883\u914d\u7f6e\nserver:\n  port: 8083 #\u7aef\u53e3\u53f7\n  servlet:\n    context-path: \/in-prod #\u4e0a\u4e0b\u6587\u8def\u5f84\nspring:\n  config:\n    activate:\n      on-profile: prod\n<\/pre>\n\n\n\n<p>2. \u6267\u884c\u4ee5\u4e0b mvn \u547d\u4ee4\uff0c\u5c06\u00a0mybootdemo \u6253\u5305\u6210 JAR\uff0c\u5e76\u5c06\u8be5 JAR \u5305\u79fb\u52a8\u5230\u672c\u6b21\u78c1\u76d8\u7684\u67d0\u4e2a\u76ee\u5f55\u4e0b\uff08\u4f8b\u5982 mySpringBoot \u76ee\u5f55\uff09\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">mvn clean package\n<\/pre>\n\n\n\n<p>3. \u5728 JAR \u5305\u6240\u5728\u76ee\u5f55\u4e0b\u521b\u5efa application.yml \uff0c\u5e76\u8bbe\u7f6e\u4e0a\u4e0b\u6587\u8def\u5f84\u4e3a\u201c\/out-default\u201d\uff0c\u5e76\u6fc0\u6d3b\u751f\u4ea7\u73af\u5883\uff08prod\uff09Profile\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">#JAR \u5305\u5916\u9ed8\u8ba4\u914d\u7f6e\nserver:\n  servlet:\n    context-path: \/out-default\n#\u5207\u6362\u914d\u7f6e\nspring:\n  profiles:\n    active: prod #\u6fc0\u6d3b\u5f00\u53d1\u73af\u5883\u914d\u7f6e\n<\/pre>\n\n\n\n<p>4. \u6253\u5f00\u547d\u4ee4\u884c\u7a97\u53e3\uff0c\u8df3\u8f6c\u5230\u00a0mySpringBoot \u76ee\u5f55\u4e0b\uff0c\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u542f\u52a8 Spring Boot\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">java -jar mybootdemo-0.0.1-SNAPSHOT.jar\n<\/pre>\n\n\n\n<p>\u542f\u52a8\u7ed3\u679c\u5982\u4e0b\u56fe\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2021\/12\/image-90-1024x363.png\" alt=\"\" class=\"wp-image-4354\" width=\"624\" height=\"220\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-90-1024x363.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-90-300x106.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-90-768x272.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-90-1536x545.png 1536w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-90-830x294.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-90-230x82.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-90-350x124.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-90-480x170.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-90.png 1770w\" sizes=\"(max-width: 624px) 100vw, 624px\" \/><\/figure><\/div>\n\n\n\n<p>\u793a\u4f8b\u5206\u6790\uff1a<\/p>\n\n\n\n<ul><li>Spring Boot \u5728\u542f\u52a8\u65f6\u4f1a\u52a0\u8f7d\u5168\u90e8\u7684 5 \u4e2a\u914d\u7f6e\u6587\u4ef6\uff0c\u5176\u4e2d\u4f4d\u4e8e JAR \u5305\u5916\u7684 application.yml \u4f18\u5148\u7ea7\u6700\u9ad8\uff1b<\/li><li>\u5728 JAR \u5305\u5916\u7684 application.yml \u4e2d\uff0c\u914d\u7f6e\u6fc0\u6d3b\u4e86\u751f\u4ea7\u73af\u5883\uff08prod\uff09Profile\uff0c\u5373 JAR \u5305\u5185\u90e8\u7684 application-prod.yml \u751f\u6548\u3002\u6b64\u65f6\uff0c\u8be5\u9879\u76ee\u4e2d\u7684\u914d\u7f6e\u6587\u4ef6\u4f18\u5148\u7ea7\u987a\u5e8f\u4e3a\uff1aJAR \u5305\u5916 application.yml &gt; JAR \u5305\u5185 application-prod.yml &gt;JAR \u5305\u5185\u5176\u4ed6\u914d\u7f6e\u6587\u4ef6;<\/li><li>application-prod.yml \u7684\u914d\u7f6e\u5185\u5bb9\u4f1a\u8986\u76d6 JAR \u5305\u5185\u6240\u6709\u5176\u4ed6\u914d\u7f6e\u6587\u4ef6\u7684\u914d\u7f6e\u5185\u5bb9\uff0c\u5373\u7aef\u53e3\u53f7\uff08port\uff09\u4e3a\u201c8083\u201d\uff0c\u4e0a\u4e0b\u6587\u8def\u5f84\uff08context-path\uff09\u4e3a\u201c\/in-prod\u201d;<\/li><li>JAR \u5305\u5185\u7684 application-prod.yml \u4e2d\u7684\u4e0a\u4e0b\u6587\u8def\u5f84\u4f1a\u88ab JAR \u5305\u5916\u7684 application.yml \u8986\u76d6\u4e3a\u201c\/out-default\u201d;<\/li><li>JAR \u5305\u5185\u7684 application-prod.yml \u4e0e JAR \u5305\u5916\u7684 application.yml\uff0c\u5f62\u6210\u4e92\u8865\u914d\u7f6e\uff0c\u5373\uff0c\u7aef\u53e3\u53f7\u4e3a\u201c8083\u201d\uff0c\u4e0a\u4e0b\u6587\u8def\u5f84\u4e3a\u201c\/out-default\u201d\u3002<\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Spring Boot \u4e0d\u4ec5\u53ef\u4ee5\u901a\u8fc7\u914d\u7f6e\u6587\u4ef6\u8fdb\u884c\u914d\u7f6e\uff0c\u8fd8\u53ef\u4ee5\u901a\u8fc7\u73af\u5883\u53d8\u91cf\u3001\u547d\u4ee4\u884c\u53c2\u6570\u7b49\u591a\u79cd\u5f62\u5f0f\u8fdb\u884c\u914d\u7f6e\u3002\u8fd9\u4e9b\u914d [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26,27],"tags":[],"_links":{"self":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/4348"}],"collection":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4348"}],"version-history":[{"count":4,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/4348\/revisions"}],"predecessor-version":[{"id":4355,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/4348\/revisions\/4355"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4348"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4348"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4348"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}