{"id":545,"date":"2019-04-06T21:10:22","date_gmt":"2019-04-06T12:10:22","guid":{"rendered":"http:\/\/www.typea.info\/blog\/index.php\/2019\/04\/06\/google_app_engine_java_standard_spring_boot_thymeleaf\/"},"modified":"2019-04-06T21:10:22","modified_gmt":"2019-04-06T12:10:22","slug":"google_app_engine_java_standard_spring_boot_thymeleaf","status":"publish","type":"post","link":"https:\/\/www.typea.info\/blog\/index.php\/2019\/04\/06\/google_app_engine_java_standard_spring_boot_thymeleaf\/","title":{"rendered":"Google App Engine Java Standard\u74b0\u5883\u306b Spring Boot\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30a8\u30f3\u30b8\u30f3 Thymeleaf\u3092\u9069\u7528"},"content":{"rendered":"<p><a href=\"https:\/\/www.typea.info\/blog\/index.php\/2019\/04\/06\/google_app_engine_java_standard_spring_boot\">Google App Engine Java Standard \u74b0\u5883\u3067\u624b\u3063\u53d6\u308a\u65e9\u304fSpring Boot \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u958b\u767a\u3059\u308b<\/a><\/p>\n<p>\u306e\u69cb\u6210\u3092\u6210\u9577\u3055\u305b\u3066\u3001\u5fc5\u8981\u306a\u9053\u5177\u3092\u305d\u308d\u3048\u3066\u3044\u304f\u3002<\/p>\n<p><a href=\"https:\/\/www.amazon.co.jp\/Spring-Boot-2-%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0%E5%85%A5%E9%96%80-%E6%8E%8C%E7%94%B0%E6%B4%A5%E8%80%B6%E4%B9%83\/dp\/4798053473\/ref=as_li_ss_il?__mk_ja_JP=%E3%82%AB%E3%82%BF%E3%82%AB%E3%83%8A&amp;keywords=Spring+Boot2&amp;qid=1554530083&amp;s=gateway&amp;sr=8-2&amp;linkCode=li2&amp;tag=typea09-22&amp;linkId=3d0197eceecf388587693a0fdd396387&amp;language=ja_JP\" target=\"_blank\"><img decoding=\"async\" src=\"\/\/ws-fe.amazon-adsystem.com\/widgets\/q?_encoding=UTF8&amp;ASIN=4798053473&amp;Format=_SL160_&amp;ID=AsinImage&amp;MarketPlace=JP&amp;ServiceVersion=20070822&amp;WS=1&amp;tag=typea09-22&amp;language=ja_JP\" border=\"0\"><\/a><img loading=\"lazy\" decoding=\"async\" width=\"1\" height=\"1\" style=\"margin: 0px !important; border: currentcolor !important; border-image: none !important;\" alt=\"\" src=\"https:\/\/ir-jp.amazon-adsystem.com\/e\/ir?t=typea09-22&amp;language=ja_JP&amp;l=li2&amp;o=9&amp;a=4798053473\" border=\"0\"><\/p>\n<p align=\"left\">\u3053\u306e<a href=\"https:\/\/amzn.to\/2FYpBnR\">\u66f8\u7c4d<\/a>\u306b\u3088\u308b\u3068\u3001\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30a8\u30f3\u30b8\u30f3\u3068\u3057\u3066\u306f\u3001Thymelear\uff08\u30bf\u30a4\u30e0\u30ea\u30fc\u30d5\uff09\u304c\u304a\u3059\u3059\u3081\u3068\u306e\u3053\u3068\u3002\u3053\u306e<a href=\"https:\/\/amzn.to\/2FYpBnR\">\u66f8\u7c4d<\/a>\u306b\u3082\u3042\u308b\u3088\u3046\u306b\u3001\u300cJSP\u3067\u3044\u3044\u3093\u3058\u3083\u306a\u3044\u306e\uff1f\u300d\u3068\u3082\u601d\u3063\u305f\u304c\u3001\u3053\u3053\u306f\u7d20\u76f4\u306b\u5f93\u3046\u3002<\/p>\n<p>\u5229\u7528\u3059\u308b\u306b\u306f\u3001pom.xml\u306b\u4ee5\u4e0b\u3092\u8ffd\u8a18\u3002<\/p>\n<p><pre class=\"prettyprint linenums\">&lt;dependency&gt;\r\n    &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n    &lt;artifactId&gt;spring-boot-starter-thymeleaf&lt;\/artifactId&gt;\r\n&lt;\/dependency&gt;\r\n<\/pre>\n<h2>1.\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8HTML\u306e\u914d\u7f6e<\/h2>\n<p>src\/main\/resources\/templates \u914d\u4e0b\u306b\u3001\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8 index.html \u3092\u914d\u7f6e<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Spring-boot-thymeleaf_11D00\/gae_spring_template_engine01.png\"><img loading=\"lazy\" decoding=\"async\" width=\"401\" height=\"327\" title=\"gae_spring_template_engine01\" style=\"display: inline; background-image: none;\" alt=\"gae_spring_template_engine01\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Spring-boot-thymeleaf_11D00\/gae_spring_template_engine01_thumb.png\" border=\"0\"><\/a><\/p>\n<p><pre class=\"prettyprint linenums\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n&lt;meta charset=\"UTF-8\"&gt;\r\n&lt;title&gt;Insert title here&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\tID:&lt;p class=\"msg\" th:text=\"${id}\"&gt;&lt;\/p&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<h2>2.\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc<\/h2>\n<p>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u8a18\u8ff0<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/index.php\/2019\/04\/06\/google_app_engine_java_standard_spring_boot\">\u524d\u56de<\/a>\u306f\u3001@RestController \u3068\u3057\u305f\u304c\u3001\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30a8\u30f3\u30b8\u30f3\u3092\u5229\u7528\u3059\u308b\u5834\u5408\u3001@Controller \u3092\u5229\u7528\u3059\u308b\u3088\u3046\u3060\u3002<\/p>\n<p>\u3068\u308a\u3042\u3048\u305a\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304b\u3089\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u5206\u96e2\u3057\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u69cb\u6210\u306b\u3057\u3066\u307f\u308b\u3002<\/p>\n<p>api&nbsp; : RestController<\/p>\n<p>page : Controller <\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Spring-boot-thymeleaf_11D00\/gae_spring_template_engine05.png\"><img loading=\"lazy\" decoding=\"async\" width=\"420\" height=\"319\" title=\"gae_spring_template_engine05\" style=\"display: inline; background-image: none;\" alt=\"gae_spring_template_engine05\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Spring-boot-thymeleaf_11D00\/gae_spring_template_engine05_thumb.png\" border=\"0\"><\/a><\/p>\n<h3>2.1 Page\u7528\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc<\/h3>\n<p>HTML\u30da\u30fc\u30b8\u7528\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc<\/p>\n<ul>\n<li>\u30d1\u30b9\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u30de\u30c3\u30d4\u30f3\u30b0<\/li>\n<li>\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u540d\u3092\u6587\u5b57\u5217\u3067\u8fd4\u3059\u3002<\/li>\n<li>\u30d1\u30e9\u30e1\u30fc\u30bf\u306b\u3001ModelAndView\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u308b<\/li>\n<\/ul>\n<p>\u306a\u3069\u3002<\/p>\n<p><pre class=\"prettyprint linenums\">package info.typea.page;\r\n\r\nimport org.springframework.stereotype.Controller;\r\nimport org.springframework.ui.Model;\r\nimport org.springframework.web.bind.annotation.PathVariable;\r\nimport org.springframework.web.bind.annotation.RequestMapping;\r\n\r\n@Controller\r\npublic class PageController {\r\n\t\r\n\t@RequestMapping(\"\/page\/{id}\")\r\n\tpublic String pageSample(\r\n\t\t\t@PathVariable String id,\r\n\t\t\tModel model) {\r\n\t\r\n\t\tmodel.addAttribute(\"id\", id);\r\n\t\treturn \"index\";\r\n\t}\r\n}\r\n<\/pre>\n<h3>2.2.Api\u7528\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc<\/h3>\n<p>\u6700\u7d42\u7684\u306b\u306f\u3001JavaScript\u304b\u3089\u3001REST API\u3092\u547c\u3073\u51fa\u3059\u69cb\u6210\u306b\u3059\u308b\u3068\u601d\u3046\u306e\u3067\u3001\u5206\u5272\u52d5\u4f5c\u78ba\u8a8d\u3002<\/p>\n<p><pre class=\"prettyprint linenums\">package info.typea.api;\r\n\r\nimport org.springframework.web.bind.annotation.GetMapping;\r\nimport org.springframework.web.bind.annotation.RestController;\r\n\r\n@RestController\r\npublic class ApiController {\r\n\t@GetMapping(\"\/api\/hello\")\r\n\tpublic String hello() {\r\n\t\treturn \"Hello GAE Java std env with Spring boot !\";\r\n\t}\r\n}\r\n<\/pre>\n<h2>3.\u52d5\u4f5c\u78ba\u8a8d<\/h2>\n<p>\u30ed\u30fc\u30ab\u30eb\u3067\u52d5\u304b\u3059\u3002OK<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Spring-boot-thymeleaf_11D00\/gae_spring_template_engine02.png\"><img loading=\"lazy\" decoding=\"async\" width=\"415\" height=\"235\" title=\"gae_spring_template_engine02\" style=\"display: inline; background-image: none;\" alt=\"gae_spring_template_engine02\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Spring-boot-thymeleaf_11D00\/gae_spring_template_engine02_thumb.png\" border=\"0\"><\/a><\/p>\n<p>GAE\u306b\u30c7\u30d7\u30ed\u30a4\u3057\u3001\u52d5\u4f5c\u78ba\u8a8dOK\uff01<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Spring-boot-thymeleaf_11D00\/gae_spring_template_engine03.png\"><img loading=\"lazy\" decoding=\"async\" width=\"507\" height=\"213\" title=\"gae_spring_template_engine03\" style=\"display: inline; background-image: none;\" alt=\"gae_spring_template_engine03\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Spring-boot-thymeleaf_11D00\/gae_spring_template_engine03_thumb.png\" border=\"0\"><\/a><\/p>\n<p>API\u5074\u3082\u78ba\u8a8dOK<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Spring-boot-thymeleaf_11D00\/gae_spring_template_engine04.png\"><img loading=\"lazy\" decoding=\"async\" width=\"513\" height=\"169\" title=\"gae_spring_template_engine04\" style=\"display: inline; background-image: none;\" alt=\"gae_spring_template_engine04\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Spring-boot-thymeleaf_11D00\/gae_spring_template_engine04_thumb.png\" border=\"0\"><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Google App Engine Java Standard \u74b0\u5883\u3067\u624b\u3063\u53d6\u308a\u65e9\u304fSpring Boot \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u958b\u767a\u3059\u308b \u306e\u69cb\u6210\u3092\u6210\u9577\u3055\u305b\u3066\u3001\u5fc5\u8981\u306a\u9053\u5177\u3092\u305d\u308d\u3048\u3066\u3044\u304f\u3002 \u3053\u306e\u66f8\u7c4d\u306b\u3088\u308b\u3068\u3001\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30a8\u30f3\u30b8\u30f3 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"sns_share_botton_hide":"","vkExUnit_sns_title":"","_vk_print_noindex":"","sitemap_hide":"","_veu_custom_css":"","veu_display_promotion_alert":"","vkexunit_cta_each_option":"","footnotes":""},"categories":[19,46,47],"tags":[],"class_list":["post-545","post","type-post","status-publish","format-standard","hentry","category-googleappengine","category-java-ee","category-spring"],"veu_head_title_object":{"title":"","add_site_title":""},"_links":{"self":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/545","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=545"}],"version-history":[{"count":0,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/545\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=545"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=545"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=545"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}