{"id":44,"date":"2019-02-21T03:45:03","date_gmt":"2019-02-21T03:45:03","guid":{"rendered":"https:\/\/www.kindsonthegenius.com\/spring-boot\/?p=44"},"modified":"2020-07-26T08:12:57","modified_gmt":"2020-07-26T08:12:57","slug":"03-spring-boot-spring-initializr","status":"publish","type":"post","link":"https:\/\/kindsonthegenius.com\/spring-boot\/03-spring-boot-spring-initializr\/","title":{"rendered":"Spring Boot &#8211; Spring Initializr"},"content":{"rendered":"<p>You can create a new Spring project using Spring Initializr. That is the name.<\/p>\n<p>First, not hat the spelling, &#8216;Initializr&#8217; is not a typo.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>So what is Spring Initializr?<\/strong><\/p>\n<p>Spring Initializr is an online tool you can use to generate Spring Starter project. Then you can download the project and open it in your local IDE.<\/p>\n<p>To use Spring Initializr, go to <a href=\"http:\/\/start.spring.io\" target=\"_blank\" rel=\"noopener\">www.start.spring.io.<\/a> The page is as shown below:<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-46 size-large aligncenter\" src=\"https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Spring-Initializr-1024x614.jpg\" alt=\"\" width=\"640\" height=\"384\" srcset=\"https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Spring-Initializr-1024x614.jpg 1024w, https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Spring-Initializr-300x180.jpg 300w, https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Spring-Initializr-768x461.jpg 768w, https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Spring-Initializr-240x145.jpg 240w, https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Spring-Initializr.jpg 1195w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Leave the Generate a &#8216;Maven Project&#8217; with &#8216;Java&#8217;.<\/p>\n<p>Also leave the Spring Boot version the default value. The value at the time of this tutorial is 2.1.3.<\/p>\n<p>&nbsp;<\/p>\n<p>Under the group enter com.tutorials (you can change it)<\/p>\n<p>Under artifact, enter FirstApp (you can also change it)<\/p>\n<p>When you are done, click on Generate Project<\/p>\n<p>The zip file would be downloaded.<\/p>\n<p>Unzip the zip file into.<\/p>\n<p>Now you can open the sts IDE.<\/p>\n<p>Go to File and choose New &gt; Open Project.<\/p>\n<p>Then navigate the to the folder that contains the downloaded project and select it<\/p>\n<p>&nbsp;<\/p>\n<p>You can see that the project opens in sts. So in the Package Explorer, expand the project and open the <em>pom.xml.<\/em> The content should look like shown below:<\/p>\n<p>&nbsp;<\/p>\n<pre style=\"margin: 0; line-height: 125%;\"><span style=\"color: #557799;\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;<\/span>\r\n<span style=\"color: #007700;\">&lt;project<\/span> <span style=\"color: #0000cc;\">xmlns=<\/span><span style=\"background-color: #fff0f0;\">\"http:\/\/maven.apache.org\/POM\/4.0.0\"<\/span> <span style=\"color: #0000cc;\">xmlns:xsi=<\/span><span style=\"background-color: #fff0f0;\">\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"<\/span>\r\n\t<span style=\"color: #0000cc;\">xsi:schemaLocation=<\/span><span style=\"background-color: #fff0f0;\">\"http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd\"<\/span><span style=\"color: #007700;\">&gt;<\/span>\r\n\t<span style=\"color: #007700;\">&lt;modelVersion&gt;<\/span>4.0.0<span style=\"color: #007700;\">&lt;\/modelVersion&gt;<\/span>\r\n\t<span style=\"color: #007700;\">&lt;parent&gt;<\/span>\r\n\t\t<span style=\"color: #007700;\">&lt;groupId&gt;<\/span>org.springframework.boot<span style=\"color: #007700;\">&lt;\/groupId&gt;<\/span>\r\n\t\t<span style=\"color: #007700;\">&lt;artifactId&gt;<\/span>spring-boot-starter-parent<span style=\"color: #007700;\">&lt;\/artifactId&gt;<\/span>\r\n\t\t<span style=\"color: #007700;\">&lt;version&gt;<\/span>2.1.3.RELEASE<span style=\"color: #007700;\">&lt;\/version&gt;<\/span>\r\n\t\t<span style=\"color: #007700;\">&lt;relativePath\/&gt;<\/span> <span style=\"color: #888888;\">&lt;!-- lookup parent from repository --&gt;<\/span>\r\n\t<span style=\"color: #007700;\">&lt;\/parent&gt;<\/span>\r\n\t<span style=\"color: #007700;\">&lt;groupId&gt;<\/span>com.kindsonthegenius<span style=\"color: #007700;\">&lt;\/groupId&gt;<\/span>\r\n\t<span style=\"color: #007700;\">&lt;artifactId&gt;<\/span>demo<span style=\"color: #007700;\">&lt;\/artifactId&gt;<\/span>\r\n\t<span style=\"color: #007700;\">&lt;version&gt;<\/span>0.0.1-SNAPSHOT<span style=\"color: #007700;\">&lt;\/version&gt;<\/span>\r\n\t<span style=\"color: #007700;\">&lt;name&gt;<\/span>demo<span style=\"color: #007700;\">&lt;\/name&gt;<\/span>\r\n\t<span style=\"color: #007700;\">&lt;description&gt;<\/span>Demo project for Spring Boot<span style=\"color: #007700;\">&lt;\/description&gt;<\/span>\r\n\r\n\t<span style=\"color: #007700;\">&lt;properties&gt;<\/span>\r\n\t\t<span style=\"color: #007700;\">&lt;java.version&gt;<\/span>1.8<span style=\"color: #007700;\">&lt;\/java.version&gt;<\/span>\r\n\t<span style=\"color: #007700;\">&lt;\/properties&gt;<\/span>\r\n\r\n\t<span style=\"color: #007700;\">&lt;dependencies&gt;<\/span>\r\n\t\t<span style=\"color: #007700;\">&lt;dependency&gt;<\/span>\r\n\t\t\t<span style=\"color: #007700;\">&lt;groupId&gt;<\/span>org.springframework.boot<span style=\"color: #007700;\">&lt;\/groupId&gt;<\/span>\r\n\t\t\t<span style=\"color: #007700;\">&lt;artifactId&gt;<\/span>spring-boot-starter<span style=\"color: #007700;\">&lt;\/artifactId&gt;<\/span>\r\n\t\t<span style=\"color: #007700;\">&lt;\/dependency&gt;<\/span>\r\n\r\n\t\t<span style=\"color: #007700;\">&lt;dependency&gt;<\/span>\r\n\t\t\t<span style=\"color: #007700;\">&lt;groupId&gt;<\/span>org.springframework.boot<span style=\"color: #007700;\">&lt;\/groupId&gt;<\/span>\r\n\t\t\t<span style=\"color: #007700;\">&lt;artifactId&gt;<\/span>spring-boot-starter-test<span style=\"color: #007700;\">&lt;\/artifactId&gt;<\/span>\r\n\t\t\t<span style=\"color: #007700;\">&lt;scope&gt;<\/span>test<span style=\"color: #007700;\">&lt;\/scope&gt;<\/span>\r\n\t\t<span style=\"color: #007700;\">&lt;\/dependency&gt;<\/span>\r\n\t<span style=\"color: #007700;\">&lt;\/dependencies&gt;<\/span>\r\n\r\n\t<span style=\"color: #007700;\">&lt;build&gt;<\/span>\r\n\t\t<span style=\"color: #007700;\">&lt;plugins&gt;<\/span>\r\n\t\t\t<span style=\"color: #007700;\">&lt;plugin&gt;<\/span>\r\n\t\t\t\t<span style=\"color: #007700;\">&lt;groupId&gt;<\/span>org.springframework.boot<span style=\"color: #007700;\">&lt;\/groupId&gt;<\/span>\r\n\t\t\t\t<span style=\"color: #007700;\">&lt;artifactId&gt;<\/span>spring-boot-maven-plugin<span style=\"color: #007700;\">&lt;\/artifactId&gt;<\/span>\r\n\t\t\t<span style=\"color: #007700;\">&lt;\/plugin&gt;<\/span>\r\n\t\t<span style=\"color: #007700;\">&lt;\/plugins&gt;<\/span>\r\n\t<span style=\"color: #007700;\">&lt;\/build&gt;<\/span>\r\n\r\n<span style=\"color: #007700;\">&lt;\/project&gt;<\/span>\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Open the the FirstAppApplication.java File<\/strong><\/p>\n<p>Expand the src\/main\/java folder and locate the FirstAppApplication.java file (demoApplication.java)<\/p>\n<p>Open it<\/p>\n<p>Write this code inside the main method:<\/p>\n<p>&nbsp;<\/p>\n<pre style=\"margin: 0; line-height: 125%;\">    System<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">out<\/span><span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">print<\/span><span style=\"color: #333333;\">(<\/span><span style=\"background-color: #fff0f0;\">\"Welcome to Spring Initializr\"<\/span><span style=\"color: #333333;\">);<\/span>\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>The file should now look like this:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-47 size-large aligncenter\" src=\"https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Main-Spring-Initializr-1024x566.jpg\" alt=\"\" width=\"640\" height=\"354\" srcset=\"https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Main-Spring-Initializr-1024x566.jpg 1024w, https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Main-Spring-Initializr-300x166.jpg 300w, https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Main-Spring-Initializr-768x424.jpg 768w, https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Main-Spring-Initializr.jpg 1178w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Click on Run in the menu.<\/p>\n<p>Select Run As &gt; Spring Application as shown below<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-48 \" src=\"https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Select-Run-as-Spring-Application.jpg\" alt=\"\" width=\"556\" height=\"315\" srcset=\"https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Select-Run-as-Spring-Application.jpg 876w, https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Select-Run-as-Spring-Application-300x170.jpg 300w, https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Select-Run-as-Spring-Application-768x436.jpg 768w\" sizes=\"auto, (max-width: 556px) 100vw, 556px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>The project would run, and you would have the output below. In the next tutorial, we would examine how to add REST endpoints.<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-49 size-large\" src=\"https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Output-of-the-Run-1024x535.jpg\" alt=\"\" width=\"640\" height=\"334\" srcset=\"https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Output-of-the-Run-1024x535.jpg 1024w, https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Output-of-the-Run-300x157.jpg 300w, https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Output-of-the-Run-768x401.jpg 768w, https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Output-of-the-Run.jpg 1263w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p><strong>Watch the Video Lesson<\/strong><\/p>\n<p><iframe loading=\"lazy\" src=\"https:\/\/www.youtube.com\/embed\/47ovM-zfn38\" width=\"100%\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>You can create a new Spring project using Spring Initializr. That is the name. First, not hat the spelling, &#8216;Initializr&#8217; is not a typo. &nbsp; &hellip; <!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":50,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[2],"tags":[],"class_list":["post-44","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-spring-boot-tutorials"],"_links":{"self":[{"href":"https:\/\/kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/posts\/44","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/comments?post=44"}],"version-history":[{"count":4,"href":"https:\/\/kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/posts\/44\/revisions"}],"predecessor-version":[{"id":232,"href":"https:\/\/kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/posts\/44\/revisions\/232"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/media\/50"}],"wp:attachment":[{"href":"https:\/\/kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/media?parent=44"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/categories?post=44"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/tags?post=44"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}