{"id":39838,"date":"2023-10-10T07:29:52","date_gmt":"2023-04-15T18:23:38","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e7%94%a8spring-boot%e6%9e%84%e5%bb%barest-api\/"},"modified":"2024-05-04T03:35:40","modified_gmt":"2024-05-03T19:35:40","slug":"%e7%94%a8spring-boot%e6%9e%84%e5%bb%barest-api","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e7%94%a8spring-boot%e6%9e%84%e5%bb%barest-api\/","title":{"rendered":"\u7528Spring Boot\u6784\u5efaRest API"},"content":{"rendered":"<h1>\u6982\u8ff0<\/h1>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u624b\u63a2\u308a\u3067 Spring Boot \u3092\u52c9\u5f37\u3057\u306a\u304c\u3089 Rest API \u3092\u69cb\u7bc9\u3057\u3066\u3044\u304f<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">Qiita \u306b\u306f\u3084\u3063\u305f\u5206\u3060\u3051\u6295\u7a3f\u3057\u3066\u3044\u304f<\/ul>\n<h1>\u65b0\u5efa\u9879\u76ee<\/h1>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d3c7537434c4406c84da3\/3-0.png\" alt=\"190817-0003.png\" \/><\/div>\n<h2>Spring Initializr \u6625\u5b63\u521d\u59cb\u5668<\/h2>\n<p>\u9879\u76eeSDK\u7248\u672c\uff1a1.8<br \/>\n\u9009\u62e9Initializr\u670d\u52a1URL\uff1a\u9ed8\u8ba4\uff08https:\/\/start.spring.io\uff09<\/p>\n<h2>\u9879\u76ee\u5143\u6570\u636e<\/h2>\n<p>\u7ec4\u7ec7\uff1acom.example<br \/>\n\u7ec4\u4ef6\uff1aspring-boot-rest-api<br \/>\n\u7c7b\u578b\uff1aGradle\u9879\u76ee\uff08\u751f\u6210\u4e00\u4e2a\u57fa\u4e8eGradle\u7684\u9879\u76ee\u6863\u6848\uff09<br \/>\n\u8bed\u8a00\uff1aJava<br \/>\n\u6253\u5305\uff1aJar<br \/>\nJava\u7248\u672c\uff1a8<br \/>\n\u7248\u672c\uff1a0.0.1-SNAPSHOT<br \/>\n\u540d\u79f0\uff1aspring-boot-rest-api<br \/>\n\u63cf\u8ff0\uff1aSpring Boot\u7684\u6f14\u793a\u9879\u76ee<br \/>\n\u5305\uff1acom.example.springbootrestapi<\/p>\n<h2>\u4f9d\u8d56\u5173\u7cfb<\/h2>\n<p>\u5f00\u53d1\u8005\u5de5\u5177: Spring Boot DevTools, Lombok<br \/>\nWeb: Spring Web Starter<br \/>\nSQL: Spring Data JPA, MySQL Driver<\/p>\n<h2>\u9879\u76ee\u8bbe\u7f6e<\/h2>\n<p>\u9805\u76ee\u540d\u7a31\uff1a\u6625\u5b63\u555f\u52d5Rest API<br \/>\n\u9805\u76ee\u4f4d\u7f6e\uff1a\u9069\u5b9c<\/p>\n<h2>\u4eceGradle\u5bfc\u5165\u6a21\u5757<\/h2>\n<p>\u4e00\u65e6\u4fdd\u6301\u9ed8\u8ba4\u8bbe\u7f6e\uff0c\u70b9\u51fbOK\u540e\u9879\u76ee\u521b\u5efa\u5b8c\u6210<\/p>\n<h1>\u5728IntelliJ\u4e2d\u542f\u7528Lombok\u3002<\/h1>\n<p>\u8bf7\u53c2\u8003\u4ee5\u4e0b\u94fe\u63a5\uff1a<br \/>\nhttps:\/\/reasonable-code.com\/intellij-lombok\/<\/p>\n<h1>\u5c06\u8bbe\u7f6e\u6587\u4ef6\u66f4\u6539\u4e3ayml\u683c\u5f0f<\/h1>\n<p>spring-boot-rest-api\/src\/main\/resources\/application.properties \u53ef\u4ee5\u88ab\u5f52\u7eb3\u4e3a\u7a0b\u5e8f\u542f\u52a8\u4e4b\u524d\u7684\u5c5e\u6027\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n<p>\u66f4\u540d<\/p>\n<p>spring-boot-rest-api\/src\/main\/resources\/application.yml \u53ef\u4ee5\u5728\u5e94\u7528\u7a0b\u5e8f.yml \u4e2d\u627e\u5230\u3002<\/p>\n<h1>\u6682\u65f6\u8bd5\u7740\u542f\u52a8\u4e00\u4e0b<\/h1>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d3c7537434c4406c84da3\/21-0.png\" alt=\"190817-0005.png\" \/><\/div>\n<p>\u53d1\u751f\u4e86\u9519\u8bef<\/p>\n<pre class=\"post-pre\"><code>Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.\r\n2019-08-17 23:19:54.141 ERROR 29198 --- [  restartedMain] o.s.b.d.LoggingFailureAnalysisReporter   : \r\n\r\n***************************\r\nAPPLICATION FAILED TO START\r\n***************************\r\n\r\nDescription:\r\n\r\nFailed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.\r\n\r\nReason: Failed to determine a suitable driver class\r\n\r\n\r\nAction:\r\n\r\nConsider the following:\r\n    If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.\r\n    If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).\r\n\r\n\r\nProcess finished with exit code 0\r\n<\/code><\/pre>\n<h1>\u4e0b\u4e00\u96c6\u7684\u9884\u544a\u7247<\/h1>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30a8\u30e9\u30fc\u306e\u8abf\u67fb<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Docker \u3067 MySQL \u69cb\u7bc9<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">Swagger \u3092\u4f7f\u3063\u3066 API \u306e\u8a2d\u8a08\u3092\u884c\u3046<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u6982\u8ff0 \u624b\u63a2\u308a\u3067 Spring Boot \u3092\u52c9\u5f37\u3057\u306a\u304c\u3089 Rest API \u3092\u69cb\u7bc9\u3057\u3066\u3044\u304f &nbsp; Qii [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-39838","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u7528Spring Boot\u6784\u5efaRest API - Blog - Silicon Cloud<\/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.silicloud.com\/zh\/blog\/\u7528spring-boot\u6784\u5efarest-api\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u7528Spring Boot\u6784\u5efaRest API\" \/>\n<meta property=\"og:description\" content=\"\u6982\u8ff0 \u624b\u63a2\u308a\u3067 Spring Boot \u3092\u52c9\u5f37\u3057\u306a\u304c\u3089 Rest API \u3092\u69cb\u7bc9\u3057\u3066\u3044\u304f &nbsp; Qii [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u7528spring-boot\u6784\u5efarest-api\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-04-15T18:23:38+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-05-03T19:35:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d3c7537434c4406c84da3\/3-0.png\" \/>\n<meta name=\"author\" content=\"\u6e05, \u626c\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u6e05, \u626c\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e7%94%a8spring-boot%e6%9e%84%e5%bb%barest-api\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e7%94%a8spring-boot%e6%9e%84%e5%bb%barest-api\/\",\"name\":\"\u7528Spring Boot\u6784\u5efaRest API - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-04-15T18:23:38+00:00\",\"dateModified\":\"2024-05-03T19:35:40+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/cb5556d2501da73d864cac945e8d9461\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e7%94%a8spring-boot%e6%9e%84%e5%bb%barest-api\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e7%94%a8spring-boot%e6%9e%84%e5%bb%barest-api\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e7%94%a8spring-boot%e6%9e%84%e5%bb%barest-api\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u7528Spring Boot\u6784\u5efaRest API\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/cb5556d2501da73d864cac945e8d9461\",\"name\":\"\u6e05, \u626c\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/32a4239de8ff29adace466261d309424a1e5fe9f7e3036bf89fe03f2e3dbe717?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/32a4239de8ff29adace466261d309424a1e5fe9f7e3036bf89fe03f2e3dbe717?s=96&d=mm&r=g\",\"caption\":\"\u6e05, \u626c\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/qingyang\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e7%94%a8spring-boot%e6%9e%84%e5%bb%barest-api\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u7528Spring Boot\u6784\u5efaRest API - Blog - Silicon Cloud","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.silicloud.com\/zh\/blog\/\u7528spring-boot\u6784\u5efarest-api\/","og_locale":"zh_CN","og_type":"article","og_title":"\u7528Spring Boot\u6784\u5efaRest API","og_description":"\u6982\u8ff0 \u624b\u63a2\u308a\u3067 Spring Boot \u3092\u52c9\u5f37\u3057\u306a\u304c\u3089 Rest API \u3092\u69cb\u7bc9\u3057\u3066\u3044\u304f &nbsp; Qii [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u7528spring-boot\u6784\u5efarest-api\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-04-15T18:23:38+00:00","article_modified_time":"2024-05-03T19:35:40+00:00","og_image":[{"url":"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d3c7537434c4406c84da3\/3-0.png"}],"author":"\u6e05, \u626c","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u6e05, \u626c","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e7%94%a8spring-boot%e6%9e%84%e5%bb%barest-api\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e7%94%a8spring-boot%e6%9e%84%e5%bb%barest-api\/","name":"\u7528Spring Boot\u6784\u5efaRest API - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-04-15T18:23:38+00:00","dateModified":"2024-05-03T19:35:40+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/cb5556d2501da73d864cac945e8d9461"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e7%94%a8spring-boot%e6%9e%84%e5%bb%barest-api\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e7%94%a8spring-boot%e6%9e%84%e5%bb%barest-api\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e7%94%a8spring-boot%e6%9e%84%e5%bb%barest-api\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u7528Spring Boot\u6784\u5efaRest API"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/cb5556d2501da73d864cac945e8d9461","name":"\u6e05, \u626c","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/32a4239de8ff29adace466261d309424a1e5fe9f7e3036bf89fe03f2e3dbe717?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/32a4239de8ff29adace466261d309424a1e5fe9f7e3036bf89fe03f2e3dbe717?s=96&d=mm&r=g","caption":"\u6e05, \u626c"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/qingyang\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e7%94%a8spring-boot%e6%9e%84%e5%bb%barest-api\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/39838","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=39838"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/39838\/revisions"}],"predecessor-version":[{"id":95875,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/39838\/revisions\/95875"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=39838"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=39838"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=39838"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}