{"id":2216,"date":"2021-07-17T11:06:43","date_gmt":"2021-07-17T02:06:43","guid":{"rendered":"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=2216"},"modified":"2021-07-17T11:57:58","modified_gmt":"2021-07-17T02:57:58","slug":"spring-mvc-web-service-%ec%83%9d%ec%84%b1%ed%95%98%ea%b8%b0","status":"publish","type":"post","link":"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=2216","title":{"rendered":"Spring MVC Web Service \uc0dd\uc131\ud558\uae30"},"content":{"rendered":"<h1>Spring MVC Web Service \uc0dd\uc131\ud558\uae30<\/h1>\n<h2>\ubaa9\ud45c<\/h2>\n<p>HTML \ud398\uc774\uc9c0\ub97c \uc81c\uacf5\ud558\ub294 \uc6f9\uc11c\ube44\uc2a4\ub97c \uc0dd\uc131\ud569\ub2c8\ub2e4.<\/p>\n<h2>\ud504\ub85c\uc81d\ud2b8 \uc0dd\uc131<\/h2>\n<p><a href=\"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=2195\">Hello, World! \ud504\ub85c\uc81d\ud2b8 \uc0dd\uc131\ud558\uae30<\/a> \ub97c \ucc38\uc870\ud574\uc11c \uc2e0\uaddc \ud504\ub85c\uc81d\ud2b8\ub97c \uc0dd\uc131\ud569\ub2c8\ub2e4.<\/p>\n<h2>\uc758\uc874\uc131 \ucd94\uac00<\/h2>\n<p><a href=\"https:\/\/www.skyer9.pe.kr\/wordpress\/wp-content\/uploads\/2021\/07\/2021-07-17-07.png\"><img decoding=\"async\" src=\"https:\/\/www.skyer9.pe.kr\/wordpress\/wp-content\/uploads\/2021\/07\/2021-07-17-07.png\" alt=\"\" \/><\/a><\/p>\n<p>build.gradle \uc744 \uc5f4\uace0 thymeleaf \ub97c \ucd94\uac00\ud569\ub2c8\ub2e4.<\/p>\n<pre><code class=\"language-gradle\">dependencies {\n    implementation &#039;org.springframework.boot:spring-boot-starter-thymeleaf&#039;\n    implementation &#039;org.springframework.boot:spring-boot-starter-web&#039;\n    compileOnly &#039;org.projectlombok:lombok&#039;\n    developmentOnly &#039;org.springframework.boot:spring-boot-devtools&#039;\n    annotationProcessor &#039;org.projectlombok:lombok&#039;\n    testImplementation &#039;org.springframework.boot:spring-boot-starter-test&#039;\n}<\/code><\/pre>\n<h2>\ud30c\uc77c \ucd94\uac00<\/h2>\n<p><a href=\"https:\/\/www.skyer9.pe.kr\/wordpress\/wp-content\/uploads\/2021\/07\/2021-07-17-08-1.png\"><img decoding=\"async\" src=\"https:\/\/www.skyer9.pe.kr\/wordpress\/wp-content\/uploads\/2021\/07\/2021-07-17-08-1.png\" alt=\"\" \/><\/a><\/p>\n<p>GreetingController.java<\/p>\n<pre><code class=\"language-java\">@Controller\npublic class GreetingController {\n\n    @GetMapping(&quot;\/greeting&quot;)\n    public String greeting(@RequestParam(name=&quot;name&quot;, required=false, defaultValue=&quot;World&quot;) String name, Model model) {\n        model.addAttribute(&quot;name&quot;, name);\n        return &quot;greeting&quot;;\n    }\n}<\/code><\/pre>\n<p>greeting.html<\/p>\n<pre><code class=\"language-html\">&lt;!DOCTYPE HTML&gt;\n&lt;html xmlns:th=&quot;http:\/\/www.thymeleaf.org&quot; lang=&quot;en&quot;&gt;\n&lt;head&gt;\n    &lt;title&gt;Getting Started: Serving Web Content&lt;\/title&gt;\n    &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text\/html; charset=UTF-8&quot; \/&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n&lt;p th:text=&quot;&#039;Hello, &#039; + ${name} + &#039;!&#039;&quot; \/&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n<h2>\ud504\ub85c\uc81d\ud2b8 \uc2e4\ud589<\/h2>\n<p>\ud504\ub85c\uc81d\ud2b8 \uc2e4\ud589 \ud6c4 \uc544\ub798\uc758 \ub9c1\ud06c\ub97c \uc5f4\uc5b4 \uacb0\uacfc\ub97c \ud655\uc778\ud569\ub2c8\ub2e4.<\/p>\n<p><a href=\"http:\/\/localhost:8080\/greeting\">http:\/\/localhost:8080\/greeting<\/a><\/p>\n<p>\uc544\ub798\ucc98\ub7fc \ud30c\ub77c\ubbf8\ud130\ub97c \ucd94\uac00\ud574 \uc8fc\uba74 \ube0c\ub77c\uc6b0\uc800\uc758 \ub0b4\uc6a9\uc774 \ubcc0\uacbd\ub429\ub2c8\ub2e4.<\/p>\n<p><a href=\"http:\/\/localhost:8080\/greeting?name=User\">http:\/\/localhost:8080\/greeting?name=User<\/a><\/p>\n<h2>Spring Boot Devtools<\/h2>\n<p>html \ud30c\uc77c\uc744 \uc218\uc815\ud574\ub3c4 \ube0c\ub77c\uc6b0\uc800\uc5d0 \ud45c\uc2dc\ub418\ub294 \ub0b4\uc6a9\uc740 \ubcc0\uacbd\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.<\/p>\n<p>\ud504\ub85c\uc81d\ud2b8\ub97c \uc7ac\uc2e4\ud589\ud574\uc57c\ub9cc \ubcc0\uacbd\ub41c \ub0b4\uc6a9\uc774 \ubc18\uc601\ub429\ub2c8\ub2e4.<\/p>\n<p>Spring Boot Devtools \ub294 \ucee8\ud14c\uc774\ub108 \uc7ac\uc2e4\ud589 \uc5c6\uc774\ub3c4 \ube0c\ub77c\uc6b0\uc800\uc5d0 \ud45c\uc2dc\ub418\ub294 \ub0b4\uc6a9\uc774 \ubcc0\uacbd\ub418\ub3c4\ub85d \ud558\ub294 \uae30\ub2a5\uc744 \uc81c\uacf5\ud569\ub2c8\ub2e4.<\/p>\n<h3>\uc124\uc815\ud30c\uc77c \uc218\uc815<\/h3>\n<p><a href=\"https:\/\/www.skyer9.pe.kr\/wordpress\/wp-content\/uploads\/2021\/07\/2021-07-17-09.png\"><img decoding=\"async\" src=\"https:\/\/www.skyer9.pe.kr\/wordpress\/wp-content\/uploads\/2021\/07\/2021-07-17-09.png\" alt=\"\" \/><\/a><\/p>\n<p>application.properties \uc758 \ud30c\uc77c\uba85\uc744 application.yml \ub85c \ubcc0\uacbd\ud569\ub2c8\ub2e4.<\/p>\n<p>\uc544\ub798 \ub0b4\uc6a9\uc744 \ucd94\uac00\ud574\uc90d\ub2c8\ub2e4.<\/p>\n<pre><code class=\"language-yaml\">spring:\n  thymeleaf:\n    cache: false<\/code><\/pre>\n<h3>IntelliJ \uc124\uc815 \ubcc0\uacbd<\/h3>\n<p>\uba54\ub274 : File -&gt; Settings -&gt; Build -&gt; Compiler \uc5d0\uc11c Build project automatically \ub97c \uccb4\ud06c\ud569\ub2c8\ub2e4.<\/p>\n<p>\uba54\ub274 : File -&gt; Settings -&gt; Build -&gt; Build Tools -&gt; Gradle \uc5d0\uc11c Build and run using \uc744 IntelliJ IDEA \ub85c \ubcc0\uacbd\ud574 \uc90d\ub2c8\ub2e4.<\/p>\n<p>Ctrl+Shift+A \ub97c \ub204\ub974\uace0, registry \uc785\ub825 \ud6c4, compiler.automake.allow.when.app.running \uc744 \uccb4\ud06c\ud569\ub2c8\ub2e4.<\/p>\n<p><a href=\"https:\/\/www.skyer9.pe.kr\/wordpress\/wp-content\/uploads\/2021\/07\/2021-07-17-10.png\"><img decoding=\"async\" src=\"https:\/\/www.skyer9.pe.kr\/wordpress\/wp-content\/uploads\/2021\/07\/2021-07-17-10.png\" alt=\"\" \/><\/a><\/p>\n<p>Run\/Debug Configurations -&gt; Running Application Update Policies \uc5d0\uc11c,<br \/>\nOn &#8216;Update&#8217; action \uc744 Hot swap classes and update trigger file if failed \ub85c,<br \/>\nOn frame deactivation \uc744 Update resources \ub85c \uc124\uc815\ud569\ub2c8\ub2e4.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Spring MVC Web Service \uc0dd\uc131\ud558\uae30 \ubaa9\ud45c HTML \ud398\uc774\uc9c0\ub97c \uc81c\uacf5\ud558\ub294 \uc6f9\uc11c\ube44\uc2a4\ub97c \uc0dd\uc131\ud569\ub2c8\ub2e4. \ud504\ub85c\uc81d\ud2b8 \uc0dd\uc131 Hello, World! \ud504\ub85c\uc81d\ud2b8 \uc0dd\uc131\ud558\uae30 \ub97c \ucc38\uc870\ud574\uc11c \uc2e0\uaddc \ud504\ub85c\uc81d\ud2b8\ub97c \uc0dd\uc131\ud569\ub2c8\ub2e4. \uc758\uc874\uc131 \ucd94\uac00 build.gradle \uc744 \uc5f4\uace0 thymeleaf \ub97c \ucd94\uac00\ud569\ub2c8\ub2e4. dependencies { implementation &#039;org.springframework.boot:spring-boot-starter-thymeleaf&#039; implementation &#039;org.springframework.boot:spring-boot-starter-web&#039; compileOnly &#039;org.projectlombok:lombok&#039; developmentOnly &#039;org.springframework.boot:spring-boot-devtools&#039; annotationProcessor &#039;org.projectlombok:lombok&#039; testImplementation &#039;org.springframework.boot:spring-boot-starter-test&#039; } \ud30c\uc77c \ucd94\uac00 GreetingController.java @Controller public class GreetingController { @GetMapping(&quot;\/greeting&quot;) public\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=2216\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29],"tags":[],"class_list":["post-2216","post","type-post","status-publish","format-standard","hentry","category-spring-boot-2-5"],"_links":{"self":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/2216","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2216"}],"version-history":[{"count":7,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/2216\/revisions"}],"predecessor-version":[{"id":2225,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/2216\/revisions\/2225"}],"wp:attachment":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2216"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2216"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2216"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}