{"id":17843,"date":"2025-06-17T19:43:59","date_gmt":"2025-06-17T11:43:59","guid":{"rendered":"https:\/\/92it.top\/?p=17843"},"modified":"2025-06-17T19:43:59","modified_gmt":"2025-06-17T11:43:59","slug":"%e8%b0%88%e8%b0%88-springboot-%e7%ba%a6%e5%ae%9a%e5%a4%a7%e4%ba%8e%e9%85%8d%e7%bd%ae","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=17843","title":{"rendered":"\u8c08\u8c08 SpringBoot \u7ea6\u5b9a\u5927\u4e8e\u914d\u7f6e"},"content":{"rendered":"\n<p>\u201c\u7ea6\u5b9a\u5927\u4e8e\u914d\u7f6e\u201d\uff08Convention Over Configuration\uff0c\u7b80\u79f0 CoC\uff09\u662f\u4e00\u79cd\u8f6f\u4ef6\u5f00\u53d1\u54f2\u5b66\uff0c\u5b83\u7684\u6838\u5fc3\u601d\u60f3\u662f\uff1a<strong>\u901a\u8fc7\u9884\u8bbe\u7684 \u201c\u7ea6\u5b9a\u201d\uff08\u5373\u901a\u7528\u7684\u89c4\u5219\u6216\u9ed8\u8ba4\u884c\u4e3a\uff09\u6765\u51cf\u5c11\u4e0d\u5fc5\u8981\u7684\u914d\u7f6e\u5de5\u4f5c\uff0c\u8ba9\u5f00\u53d1\u8005\u4e13\u6ce8\u4e8e\u4e1a\u52a1\u903b\u8f91\u800c\u975e\u57fa\u7840\u8bbe\u65bd<\/strong>\u3002<\/p>\n\n\n\n<p><strong>\u80cc\u666f<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>Spring Boot \u7684\u6838\u5fc3\u4f18\u52bf\u4e4b\u4e00\u5c31\u662f\u00a0<strong>\u201c\u7ea6\u5b9a\u5927\u4e8e\u914d\u7f6e\u201d\uff08Convention Over Configuration\uff09<\/strong>\uff0c\u5b83\u901a\u8fc7\u81ea\u52a8\u5316\u914d\u7f6e\u548c Starter \u4f9d\u8d56\u673a\u5236\uff0c\u5e2e\u5f00\u53d1\u8005\u7701\u53bb\u4e86\u4f20\u7edf Spring \u9879\u76ee\u4e2d\u5927\u91cf\u7e41\u7410\u7684\u914d\u7f6e\u5de5\u4f5c\uff0c\u5b9e\u73b0\u00a0<strong>\u201c\u96f6\u914d\u7f6e\u542f\u52a8\u201d<\/strong>\u3002\u4ee5\u4e0b\u662f\u5177\u4f53\u89e3\u91ca\uff1a<\/p>\n\n\n\n<p>\u5728 Spring Boot \u4e4b\u524d\uff0c\u642d\u5efa\u4e00\u4e2a\u5b8c\u6574\u7684 Spring \u9879\u76ee\u9700\u8981\uff1a<\/p>\n\n\n\n<p><strong>\u624b\u52a8\u914d\u7f6e XML \u6216 Java Config<\/strong><\/p>\n\n\n\n<ul>\n<li>\u914d\u7f6e DispatcherServlet\u3001\u7ec4\u4ef6\u626b\u63cf\u8def\u5f84\u3001\u4e8b\u52a1\u7ba1\u7406\u5668\u3001\u6570\u636e\u6e90\u7b49\u3002<\/li>\n\n\n\n<li>\u793a\u4f8b\uff08XML \u914d\u7f6e\uff09\uff1a<\/li>\n<\/ul>\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=\"\">&lt;context:component-scan base-package=\"com.example.demo\" \/>\n&lt;bean id=\"dataSource\" class=\"org.apache.commons.dbcp2.BasicDataSource\">\n    &lt;property name=\"driverClassName\" value=\"com.mysql.jdbc.Driver\" \/>\n    &lt;property name=\"url\" value=\"jdbc:mysql:\/\/localhost:3306\/mydb\" \/>\n&lt;\/bean><\/pre>\n\n\n\n<p><strong>\u7ba1\u7406\u4f9d\u8d56\u5730\u72f1<\/strong><\/p>\n\n\n\n<ul>\n<li>\u9700\u8981\u7cbe\u786e\u5339\u914d\u5404\u7ec4\u4ef6\u7248\u672c\uff08\u5982 Spring\u3001Hibernate\u3001Jackson\uff09\uff0c\u7248\u672c\u51b2\u7a81\u5e38\u89c1\u3002<\/li>\n\n\n\n<li>\u4f8b\u5982\uff0c\u5f15\u5165 Spring MVC \u65f6\uff0c\u9700\u624b\u52a8\u6dfb\u52a0 servlet-api\u3001jackson-databind \u7b49\u4f9d\u8d56\u3002<\/li>\n<\/ul>\n\n\n\n<p><strong>\u90e8\u7f72\u590d\u6742<\/strong><\/p>\n\n\n\n<ul>\n<li>\u9700\u8981\u5916\u90e8 Tomcat\/Jetty \u670d\u52a1\u5668\uff0c\u914d\u7f6e Web.xml \u6216 Servlet \u521d\u59cb\u5316\u7c7b\u3002<\/li>\n<\/ul>\n\n\n\n<p><strong>\u4e00\u3001\u901a\u4fd7\u7c7b\u6bd4\uff1a\u50cf \u201c\u4f4f\u9152\u5e97\u201d \u800c\u4e0d\u662f \u201c\u76d6\u623f\u5b50\u201d<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u4f20\u7edf\u5f00\u53d1\uff08\u914d\u7f6e\u5730\u72f1\uff09\uff1a<\/p>\n\n\n\n<ul>\n<li>\u5c31\u50cf \u201c\u81ea\u5df1\u76d6\u623f\u5b50\u201d\uff1a<br>\u4f60\u9700\u8981\u51b3\u5b9a\u6bcf\u4e00\u4e2a\u7ec6\u8282 \u2014\u2014 \u5899\u5237\u4ec0\u4e48\u989c\u8272\u3001\u63d2\u5ea7\u88c5\u5728\u54ea\u91cc\u3001\u9a6c\u6876\u9009\u4ec0\u4e48\u578b\u53f7\u2026\u2026 \u5373\u4f7f\u5927\u90e8\u5206\u9700\u6c42\u548c\u522b\u4eba\u4e00\u6837\uff0c\u4e5f\u5f97\u4ece\u5934\u8bbe\u8ba1\u3002<\/li>\n\n\n\n<li><strong>\u793a\u4f8b<\/strong>\uff1a\u5728\u4f20\u7edf Spring \u4e2d\uff0c\u914d\u7f6e\u6570\u636e\u6e90\u9700\u8981\u5199\u51e0\u5341\u884c XML \u6216 Java Config\uff0c\u5373\u4f7f 90% \u7684\u9879\u76ee\u914d\u7f6e\u90fd\u662f\u76f8\u4f3c\u7684\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u7ea6\u5b9a\u5927\u4e8e\u914d\u7f6e\uff08Spring Boot\uff09\uff1a<\/p>\n\n\n\n<ul>\n<li>\u5c31\u50cf \u201c\u4f4f\u9152\u5e97\u201d\uff1a<br>\u9152\u5e97\u5df2\u7ecf\u6309\u6807\u51c6\u5e03\u7f6e\u597d\u623f\u95f4\uff08\u5e8a\u3001\u6d74\u5ba4\u3001\u7a7a\u8c03\uff09\uff0c\u4f60\u53ea\u9700\u5165\u4f4f\u5373\u53ef\u3002\u5982\u679c\u6709\u7279\u6b8a\u9700\u6c42\uff08\u5982\u52a0\u5f20\u5e8a\uff09\uff0c\u518d\u5355\u72ec\u63d0\u51fa\uff08\u5c11\u91cf\u914d\u7f6e\uff09\u3002<\/li>\n\n\n\n<li><strong>\u793a\u4f8b<\/strong>\uff1aSpring Boot \u9ed8\u8ba4\u914d\u7f6e\u597d\u6570\u636e\u6e90\u3001Web \u670d\u52a1\u5668\u7b49\uff0c\u4f60\u53ea\u9700\u5728&nbsp;<code>application.properties<\/code>&nbsp;\u4e2d\u6539\u51e0\u4e2a\u53c2\u6570\uff08\u5982\u6570\u636e\u5e93 URL\uff09\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u3000<\/p>\n\n\n\n<p><strong>\u4e8c\u3001Spring Boot \u4e2d\u7684\u5177\u4f53\u4f53\u73b0<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>1.&nbsp;<strong>\u76ee\u5f55\u7ed3\u6784\u7ea6\u5b9a<\/strong><\/p>\n\n\n\n<p>Spring Boot \u9ed8\u8ba4\u9075\u5faa\u7279\u5b9a\u7684\u76ee\u5f55\u7ed3\u6784\uff0c\u65e0\u9700\u989d\u5916\u914d\u7f6e\uff1a<\/p>\n\n\n\n<ul>\n<li><code>src\/main\/java<\/code>\uff1aJava \u4ee3\u7801<\/li>\n\n\n\n<li><code>src\/main\/resources<\/code>\uff1a\u914d\u7f6e\u6587\u4ef6\uff08application.properties\u3001static\/\u3001templates\/\uff09<\/li>\n\n\n\n<li><code>src\/test\/java<\/code>\uff1a\u6d4b\u8bd5\u4ee3\u7801<\/li>\n<\/ul>\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=\"\">src\/main\/java\/         # Java \u4ee3\u7801\n  com\/example\/demo\/    # \u4e3b\u5305\u8def\u5f84\n    DemoApplication.java  # \u4e3b\u5e94\u7528\u7c7b\n    \nsrc\/main\/resources\/    # \u8d44\u6e90\u6587\u4ef6\n  application.properties # \u914d\u7f6e\u6587\u4ef6\n  static\/              # \u9759\u6001\u8d44\u6e90\uff08CSS\/JS\/\u56fe\u7247\uff09\n  templates\/           # \u6a21\u677f\u6587\u4ef6\uff08Thymeleaf\uff09\n  \nsrc\/test\/java\/         # \u6d4b\u8bd5\u4ee3\u7801<\/pre>\n\n\n\n<p><strong>\u597d\u5904<\/strong>\uff1a\u65e0\u9700\u914d\u7f6e\u7ec4\u4ef6\u626b\u63cf\u8def\u5f84\uff0cSpring Boot \u81ea\u52a8\u4ece&nbsp;<code>DemoApplication<\/code>&nbsp;\u6240\u5728\u5305\u5f00\u59cb\u626b\u63cf\u3002<\/p>\n\n\n\n<p>\u3000<\/p>\n\n\n\n<p><strong>2.&nbsp;\u81ea\u52a8\u914d\u7f6e<\/strong><\/p>\n\n\n\n<p>Spring Boot \u6839\u636e\u7c7b\u8def\u5f84\u4e2d\u7684\u4f9d\u8d56\u81ea\u52a8\u914d\u7f6e Bean\uff1a<\/p>\n\n\n\n<ul>\n<li><strong>\u793a\u4f8b<\/strong>\uff1a<br>\u82e5\u5f15\u5165&nbsp;<code>spring-boot-starter-web<\/code>\uff0c\u5219\u81ea\u52a8\u914d\u7f6e\uff1a<ul><li>\u5d4c\u5165\u5f0f Tomcat \u670d\u52a1\u5668<\/li><li>DispatcherServlet\uff08Spring MVC \u7684\u6838\u5fc3\uff09<\/li><li>JSON \u5e8f\u5217\u5316 \/ \u53cd\u5e8f\u5217\u5316\uff08Jackson\uff09<\/li><li>\u9ed8\u8ba4\u9519\u8bef\u5904\u7406\u9875\u9762<\/li><\/ul><strong>\u65e0\u9700\u624b\u52a8\u914d\u7f6e<\/strong>\uff0c\u76f4\u63a5\u5199 Controller \u5373\u53ef\uff1a<\/li>\n<\/ul>\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=\"\">@RestController\npublic class HelloController {\n    @GetMapping(\"\/\")\n    public String hello() {\n        return \"Hello, Spring Boot!\";\n    }\n}<\/pre>\n\n\n\n<p>\u3000<\/p>\n\n\n\n<p><strong>3.&nbsp;\u9ed8\u8ba4\u5c5e\u6027\u503c<\/strong><\/p>\n\n\n\n<p>Spring Boot \u4e3a\u51e0\u4e4e\u6240\u6709\u914d\u7f6e\u9879\u63d0\u4f9b\u9ed8\u8ba4\u503c\uff0c\u4f60\u53ea\u9700\u8986\u76d6\u9700\u8981\u4fee\u6539\u7684\u90e8\u5206\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=\"\"># application.properties\uff08\u53ea\u9700\u914d\u7f6e\u4e0e\u9ed8\u8ba4\u503c\u4e0d\u540c\u7684\u90e8\u5206\uff09\nserver.port=8081        # \u9ed8\u8ba4\u662f 8080\nspring.datasource.url=jdbc:mysql:\/\/localhost\/mydb<\/pre>\n\n\n\n<p>\u3000<\/p>\n\n\n\n<p><strong>4.&nbsp;Starter \u4f9d\u8d56<\/strong><\/p>\n\n\n\n<p>Starter \u662f\u4e00\u7ec4\u9884\u5b9a\u4e49\u7684\u4f9d\u8d56\u96c6\u5408\uff0c\u907f\u514d\u624b\u52a8\u7ba1\u7406\u7248\u672c\u51b2\u7a81\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=\"\">&lt;!-- \u6dfb\u52a0 Web \u529f\u80fd\u53ea\u9700\u8fd9\u4e00\u884c -->\n&lt;dependency>\n    &lt;groupId>org.springframework.boot&lt;\/groupId>\n    &lt;artifactId>spring-boot-starter-web&lt;\/artifactId>\n&lt;\/dependency><\/pre>\n\n\n\n<p>Starter \u4f1a\u81ea\u52a8\u5f15\u5165\uff1a<\/p>\n\n\n\n<ul>\n<li>spring-webmvc<\/li>\n\n\n\n<li>tomcat-embed-core<\/li>\n\n\n\n<li>spring-boot-starter-json<\/li>\n\n\n\n<li>&#8230; \u4ee5\u53ca\u5b83\u4eec\u7684\u517c\u5bb9\u7248\u672c\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u5e38\u7528 Starter\uff1a<\/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=\"\">&lt;!-- Web \u5e94\u7528 -->\n&lt;dependency>\n    &lt;groupId>org.springframework.boot&lt;\/groupId>\n    &lt;artifactId>spring-boot-starter-web&lt;\/artifactId>\n&lt;\/dependency>\n\n&lt;!-- JPA \u6570\u636e\u8bbf\u95ee -->\n&lt;dependency>\n    &lt;groupId>org.springframework.boot&lt;\/groupId>\n    &lt;artifactId>spring-boot-starter-data-jpa&lt;\/artifactId>\n&lt;\/dependency>\n\n&lt;!-- \u6d4b\u8bd5 -->\n&lt;dependency>\n    &lt;groupId>org.springframework.boot&lt;\/groupId>\n    &lt;artifactId>spring-boot-starter-test&lt;\/artifactId>\n    &lt;scope>test&lt;\/scope>\n&lt;\/dependency><\/pre>\n\n\n\n<p>\u3000<\/p>\n\n\n\n<p><strong>5.\u5d4c\u5165\u5f0f\u670d\u52a1\u5668<\/strong><\/p>\n\n\n\n<p>Spring Boot \u5185\u7f6e Tomcat\u3001Jetty \u6216 Undertow\uff0c\u65e0\u9700\u90e8\u7f72 WAR \u6587\u4ef6\uff0c\u76f4\u63a5\u901a\u8fc7\u00a0<code>java -jar<\/code>\u00a0\u8fd0\u884c\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=\"\"># \u53ea\u9700\u5728 application.properties \u4e2d\u6307\u5b9a\u7aef\u53e3\nserver.port=8081<\/pre>\n\n\n\n<p><strong>\u4e09\u3001\u4e3a\u4ec0\u4e48\u8981\u9075\u5faa\u7ea6\u5b9a\uff1f<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<ol>\n<li><strong>\u63d0\u9ad8\u5f00\u53d1\u6548\u7387<\/strong>\n<ul>\n<li>\u51cf\u5c11\u91cd\u590d\u914d\u7f6e\uff0c\u4e13\u6ce8\u4e1a\u52a1\u903b\u8f91\u3002<\/li>\n\n\n\n<li>\u4f8b\u5982\uff1a\u4f20\u7edf Spring \u914d\u7f6e\u6570\u636e\u5e93\u9700\u8981 20 \u884c\u4ee3\u7801\uff0cSpring Boot \u53ea\u9700 3 \u884c\uff08URL\u3001\u7528\u6237\u540d\u3001\u5bc6\u7801\uff09\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u964d\u4f4e\u5b66\u4e60\u6210\u672c<\/strong>\n<ul>\n<li>\u65b0\u5f00\u53d1\u8005\u65e0\u9700\u8bb0\u5fc6\u590d\u6742\u914d\u7f6e\uff0c\u9075\u5faa\u7ea6\u5b9a\u5373\u53ef\u3002<\/li>\n\n\n\n<li>\u4f8b\u5982\uff1a\u6240\u6709 Spring Boot \u9879\u76ee\u7684\u542f\u52a8\u65b9\u5f0f\u90fd\u662f&nbsp;<code>SpringApplication.run()<\/code>\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u4ee3\u7801\u4e00\u81f4\u6027<\/strong>\n<ul>\n<li>\u56e2\u961f\u9879\u76ee\u7ed3\u6784\u7edf\u4e00\uff0c\u4fbf\u4e8e\u534f\u4f5c\u548c\u7ef4\u62a4\u3002<\/li>\n\n\n\n<li>\u4f8b\u5982\uff1a\u6240\u6709\u7ec4\u4ef6\u90fd\u6309\u7ea6\u5b9a\u653e\u5728&nbsp;<code>controller\/<\/code>\u3001<code>service\/<\/code>\u3001<code>repository\/<\/code>&nbsp;\u5305\u4e0b\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u51cf\u5c11\u9519\u8bef<\/strong>\n<ul>\n<li>\u81ea\u52a8\u914d\u7f6e\u51cf\u5c11\u4eba\u4e3a\u914d\u7f6e\u9519\u8bef\uff08\u5982\u7248\u672c\u4e0d\u517c\u5bb9\u3001Bean \u547d\u540d\u51b2\u7a81\uff09\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p>\u3000<\/p>\n\n\n\n<p><strong>\u56db\u3001\u4f55\u65f6\u9700\u8981\u6253\u7834\u7ea6\u5b9a\uff1f<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u7ea6\u5b9a\u5e76\u975e\u5f3a\u5236\uff0c\u5f53\u9ed8\u8ba4\u884c\u4e3a\u65e0\u6cd5\u6ee1\u8db3\u9700\u6c42\u65f6\uff0c\u53ef\u4ee5\uff1a<\/p>\n\n\n\n<ol>\n<li><strong>\u8986\u76d6\u9ed8\u8ba4\u914d\u7f6e<\/strong>\n<ul>\n<li>\u4f8b\u5982\uff1a\u4fee\u6539\u9ed8\u8ba4\u7aef\u53e3\u3001\u81ea\u5b9a\u4e49\u9519\u8bef\u5904\u7406\u5668\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\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=\"\"># application.properties\nserver.port=8081<\/pre>\n\n\n\n<ol>\n<li><strong>\u7981\u7528\u81ea\u52a8\u914d\u7f6e<\/strong><ul><li>\u4f8b\u5982\uff1a\u7981\u7528\u9ed8\u8ba4\u7684\u6570\u636e\u6e90\uff0c\u4f7f\u7528\u81ea\u5b9a\u4e49\u914d\u7f6e\u3002<\/li><\/ul><\/li>\n<\/ol>\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=\"\">@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)\npublic class MyApp { ... }\n<\/pre>\n\n\n\n<ol>\n<li><strong>\u81ea\u5b9a\u4e49 Starter<\/strong>\n<ul>\n<li>\u4e3a\u56e2\u961f\u6216\u9879\u76ee\u521b\u5efa\u4e13\u7528\u7684 Starter\uff0c\u5c01\u88c5\u7279\u5b9a\u4e1a\u52a1\u7684\u7ea6\u5b9a\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p>\u3000<\/p>\n\n\n\n<p><strong>\u4e94\u3001\u5176\u4ed6\u9886\u57df\u7684 \u201c\u7ea6\u5b9a\u5927\u4e8e\u914d\u7f6e\u201d<\/strong><\/p>\n\n\n\n<ul>\n<li>Maven \u9879\u76ee\u7ed3\u6784<\/li>\n<\/ul>\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=\"\">src\/main\/java\/     # \u6e90\u4ee3\u7801\nsrc\/main\/resources\/ # \u8d44\u6e90\u6587\u4ef6\nsrc\/test\/java\/     # \u6d4b\u8bd5\u4ee3\u7801<\/pre>\n\n\n\n<p>\u65e0\u9700\u914d\u7f6e\u7f16\u8bd1\u5668\u548c\u6d4b\u8bd5\u8fd0\u884c\u5668\u7684\u8def\u5f84\u3002<\/p>\n\n\n\n<p>\u3000<\/p>\n\n\n\n<ul>\n<li>REST API \u8bbe\u8ba1<\/li>\n<\/ul>\n\n\n\n<p>\u7ea6\u5b9a URL \u8def\u5f84\u548c HTTP \u65b9\u6cd5\uff1a<\/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=\"\">GET \/users        # \u83b7\u53d6\u7528\u6237\u5217\u8868\nPOST \/users       # \u521b\u5efa\u7528\u6237\nGET \/users\/{id}   # \u83b7\u53d6\u5355\u4e2a\u7528\u6237<\/pre>\n\n\n\n<p>\u51cf\u5c11\u6587\u6863\u548c\u6c9f\u901a\u6210\u672c\u3002<\/p>\n\n\n\n<p>\u3000<\/p>\n\n\n\n<ul>\n<li>\u6570\u636e\u5e93\u8fc1\u79fb\u5de5\u5177\uff08Flyway\/Liquibase\uff09<\/li>\n<\/ul>\n\n\n\n<p>\u7ea6\u5b9a SQL \u6587\u4ef6\u547d\u540d\u89c4\u5219\uff1a<\/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=\"\">V1__Initial_Setup.sql\nV2__Add_User_Table.sql<\/pre>\n\n\n\n<p>\u81ea\u52a8\u6309\u7248\u672c\u53f7\u6267\u884c\u8fc1\u79fb\u3002<\/p>\n\n\n\n<p>\u3000<\/p>\n\n\n\n<p><strong>\u516d\u3001\u603b\u7ed3<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>\u201c\u7ea6\u5b9a\u5927\u4e8e\u914d\u7f6e\u201d \u662f\u4e00\u79cd\u5e73\u8861\u6548\u7387\u4e0e\u7075\u6d3b\u6027\u7684\u54f2\u5b66<\/strong>\uff1a<\/p>\n\n\n\n<ul>\n<li><strong>\u9ed8\u8ba4\u60c5\u51b5\u4e0b<\/strong>\uff1a\u9075\u5faa\u7ea6\u5b9a\uff0c\u5feb\u901f\u642d\u5efa\u9879\u76ee\uff1b<\/li>\n\n\n\n<li><strong>\u9700\u8981\u5b9a\u5236\u65f6<\/strong>\uff1a\u901a\u8fc7\u5c11\u91cf\u914d\u7f6e\u8986\u76d6\u9ed8\u8ba4\u884c\u4e3a\u3002<\/li>\n<\/ul>\n\n\n\n<p>Spring Boot \u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c\u5c06\u4f20\u7edf Spring \u9879\u76ee\u7684\u914d\u7f6e\u5de5\u4f5c\u91cf\u4ece \u201c\u5929\u201d \u7ea7\u964d\u4f4e\u5230 \u201c\u5206\u949f\u201d \u7ea7\uff0c\u8ba9\u5f00\u53d1\u8005\u771f\u6b63\u4e13\u6ce8\u4e8e \u201c\u5199\u4e1a\u52a1\u4ee3\u7801\u201d \u800c\u975e \u201c\u642d\u57fa\u7840\u8bbe\u65bd\u201d\u3002\u8fd9\u4e5f\u662f Spring Boot \u6210\u4e3a Java \u4f01\u4e1a\u7ea7\u5f00\u53d1\u9996\u9009\u6846\u67b6\u7684\u6838\u5fc3\u539f\u56e0\u4e4b\u4e00\u3002\u7f16\u8f91\u5206\u4eab<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u201c\u7ea6\u5b9a\u5927\u4e8e\u914d\u7f6e\u201d\uff08Convention Over Configuration\uff0c\u7b80\u79f0 CoC\uff09\u662f\u4e00\u79cd\u8f6f\u4ef6\u5f00\u53d1\u54f2\u5b66 [&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\/17843"}],"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=17843"}],"version-history":[{"count":3,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/17843\/revisions"}],"predecessor-version":[{"id":17846,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/17843\/revisions\/17846"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=17843"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=17843"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=17843"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}