{"id":29,"date":"2019-02-19T23:06:09","date_gmt":"2019-02-19T23:06:09","guid":{"rendered":"https:\/\/www.kindsonthegenius.com\/spring-boot\/?p=29"},"modified":"2020-07-26T08:12:29","modified_gmt":"2020-07-26T08:12:29","slug":"02-spring-boot-starter-project","status":"publish","type":"post","link":"https:\/\/kindsonthegenius.com\/spring-boot\/02-spring-boot-starter-project\/","title":{"rendered":"Spring Boot &#8211; Starter Project"},"content":{"rendered":"<p>In this lesson we would go through how to create a Spring Starter Project. But first, we need to set up the Spring IDE.<\/p>\n<p>&nbsp;<\/p>\n<ol>\n<li><a href=\"#t1\"> Download and Install Spring-Tool-Suite(sts)<\/a><\/li>\n<li><a href=\"#t2\">Create a New Starter Project<\/a><\/li>\n<li><a href=\"#t3\">Examine the main class<\/a><\/li>\n<li><a href=\"#t4\">Examine the pom.xml File<\/a><\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<h4 id=\"t1\">1. Download and Install Spring-Tool-Suite(sts)<\/h4>\n<p>First download Spring sts:<\/p>\n<table align=\"center\">\n<tbody>\n<tr>\n<td><a href=\"https:\/\/download.springsource.com\/release\/STS\/3.9.7.RELEASE\/dist\/e4.10\/spring-tool-suite-3.9.7.RELEASE-e4.10.0-win32-x86_64.zip\" target=\"_blank\" rel=\"noopener\">Download for Windows<\/a><\/td>\n<td><a href=\"https:\/\/download.springsource.com\/release\/STS\/3.9.7.RELEASE\/dist\/e4.10\/spring-tool-suite-3.9.7.RELEASE-e4.10.0-macosx-cocoa-x86_64.dmg\" target=\"_blank\" rel=\"noopener\">Spring sts\u00a0 Download for Mac<\/a><\/td>\n<td style=\"text-align: left;\"><a href=\"https:\/\/download.springsource.com\/release\/STS\/3.9.7.RELEASE\/dist\/e4.10\/spring-tool-suite-3.9.7.RELEASE-e4.10.0-linux-gtk-x86_64.tar.gz\" target=\"_blank\" rel=\"noopener\">Download for Linux<\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>If you downloaded for Windows (64 bit), then you will have it as a zip file.<\/p>\n<p>Unzip the file into your drive C.<\/p>\n<p>Open the file and locate the STS.exe file and open it (you can add a shortcut to your desktop)<\/p>\n<p>If you followed the procedure, then you will have the interface as shown below:<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-37 aligncenter\" src=\"https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Spring-Boot-Interface.jpg\" alt=\"Spring Boot Interface\" width=\"599\" height=\"319\" srcset=\"https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Spring-Boot-Interface.jpg 981w, https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Spring-Boot-Interface-300x160.jpg 300w, https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Spring-Boot-Interface-768x409.jpg 768w\" sizes=\"auto, (max-width: 599px) 100vw, 599px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h4 id=\"t2\">2. Create a new Starter Project<\/h4>\n<p>Click on File<\/p>\n<p>Select New and Choose Spring Starter project (Look at the figure below)<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-38 \" src=\"https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Choose-Spring-Starter-Project.jpg\" alt=\"\" width=\"695\" height=\"469\" srcset=\"https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Choose-Spring-Starter-Project.jpg 825w, https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Choose-Spring-Starter-Project-300x203.jpg 300w, https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Choose-Spring-Starter-Project-768x519.jpg 768w\" sizes=\"auto, (max-width: 695px) 100vw, 695px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>The New Spring Starter Project dialog box is shown as below.<\/p>\n<p>So you can change the field marked in red if you want (or you can use the values in used)<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-39 aligncenter\" src=\"https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/New-Starter-Project-Dialog.jpg\" alt=\"\" width=\"586\" height=\"543\" srcset=\"https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/New-Starter-Project-Dialog.jpg 855w, https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/New-Starter-Project-Dialog-300x278.jpg 300w, https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/New-Starter-Project-Dialog-768x712.jpg 768w\" sizes=\"auto, (max-width: 586px) 100vw, 586px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>After you have completed the fields in red, just click Next. The next\u00a0 dialog allows you to select dependencies.<\/p>\n<p>Under Available, enter <strong>web<\/strong>. Then select the web check box. We need this because we want to create a web application<\/p>\n<p>Then remove web and enter <strong>jpa<\/strong>. Next select the jpa checkbox. This would add dependency that enables us connect to database.<\/p>\n<p>You dialog box would be as shown below (without the Frequently Used section)<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-40 \" src=\"https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Select-Dependencies.jpg\" alt=\"\" width=\"583\" height=\"541\" srcset=\"https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Select-Dependencies.jpg 646w, https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Select-Dependencies-300x278.jpg 300w\" sizes=\"auto, (max-width: 583px) 100vw, 583px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Go ahead to click on finish<\/p>\n<p>After some seconds, your project would be set up. (ensure your computer is connected to the internet)<\/p>\n<p>At the left side, under Package Explorer, you can see your project. Expand it as shown in the Figure below.<\/p>\n<p>Then open the <strong>FirstAppApplication.java<\/strong> file<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-41 size-large aligncenter\" src=\"https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Expand-your-project-1024x694.jpg\" alt=\"\" width=\"640\" height=\"434\" srcset=\"https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Expand-your-project-1024x694.jpg 1024w, https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Expand-your-project-300x203.jpg 300w, https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Expand-your-project-768x521.jpg 768w, https:\/\/kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/2019\/02\/Expand-your-project.jpg 1195w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h4 id=\"t3\">3. Examine the Main Class File<\/h4>\n<p>The FirstAppApplication.java file is the main class file.<\/p>\n<p>Check that the content is as shown below<\/p>\n<p>You can refer to <a href=\"https:\/\/kindsonthegenius.com\/spring-boot\/spring-boot-introduction\/\">Tutorial 1(Spring Boot Introduction)<\/a> to understand the @SpringBootApplication annotation<\/p>\n<p>The SpringApplicaiton.run() method tells Spring Boot to bootstrap the application from this class.<\/p>\n<p>&nbsp;<\/p>\n<pre style=\"margin: 0; line-height: 125%;\"><span style=\"color: #008800; font-weight: bold;\">package<\/span> com<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">kindsonthegenius<\/span><span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">demo<\/span><span style=\"color: #333333;\">;<\/span>\r\n\r\n<span style=\"color: #008800; font-weight: bold;\">import<\/span> <span style=\"color: #0e84b5; font-weight: bold;\">org.springframework.boot.SpringApplication<\/span><span style=\"color: #333333;\">;<\/span>\r\n<span style=\"color: #008800; font-weight: bold;\">import<\/span> <span style=\"color: #0e84b5; font-weight: bold;\">org.springframework.boot.autoconfigure.SpringBootApplication<\/span><span style=\"color: #333333;\">;<\/span>\r\n\r\n<span style=\"color: #555555; font-weight: bold;\">@SpringBootApplication<\/span>\r\n<span style=\"color: #008800; font-weight: bold;\">public<\/span> <span style=\"color: #008800; font-weight: bold;\">class<\/span> <span style=\"color: #bb0066; font-weight: bold;\">FirstAppApplication<\/span> <span style=\"color: #333333;\">{<\/span>\r\n\r\n\t<span style=\"color: #008800; font-weight: bold;\">public<\/span> <span style=\"color: #008800; font-weight: bold;\">static<\/span> <span style=\"color: #333399; font-weight: bold;\">void<\/span> <span style=\"color: #0066bb; font-weight: bold;\">main<\/span><span style=\"color: #333333;\">(<\/span>String<span style=\"color: #333333;\">[]<\/span> args<span style=\"color: #333333;\">)<\/span> <span style=\"color: #333333;\">{<\/span>\r\n\t\tSpringApplication<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">run<\/span><span style=\"color: #333333;\">(<\/span>FirstAppApplication<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">class<\/span><span style=\"color: #333333;\">,<\/span> args<span style=\"color: #333333;\">);<\/span>\r\n\t<span style=\"color: #333333;\">}<\/span>\r\n\r\n<span style=\"color: #333333;\">}<\/span>\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h4 id=\"t4\">4 .Examine the pom.xml File<\/h4>\n<p>Open the pom.xml file<\/p>\n<p>Check that the pom.xml file contains the following dependencies. You can find the two dependencies you selected during startup (web and jpa)<\/p>\n<p>&nbsp;<\/p>\n<pre style=\"margin: 0; line-height: 125%;\"><span style=\"color: #007700;\">&lt;dependencies&gt;<\/span>\r\n\r\n\t<span style=\"color: #007700;\">&lt;dependency&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-data-jpa<span style=\"color: #007700;\">&lt;\/artifactId&gt;<\/span>\r\n\t<span style=\"color: #007700;\">&lt;\/dependency&gt;<\/span>\r\n\t\r\n\t<span style=\"color: #007700;\">&lt;dependency&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-web<span style=\"color: #007700;\">&lt;\/artifactId&gt;<\/span>\r\n\t<span style=\"color: #007700;\">&lt;\/dependency&gt;<\/span>\r\n\r\n\t<span style=\"color: #007700;\">&lt;dependency&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-test<span style=\"color: #007700;\">&lt;\/artifactId&gt;<\/span>\r\n\t\t<span style=\"color: #007700;\">&lt;scope&gt;<\/span>test<span style=\"color: #007700;\">&lt;\/scope&gt;<\/span>\r\n\t<span style=\"color: #007700;\">&lt;\/dependency&gt;<\/span>\r\n\t\r\n<span style=\"color: #007700;\">&lt;\/dependencies&gt;<\/span>\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Now we have set up our application.<\/p>\n<p>In the next lesson we would add a REST endpoint, deploy and run the application.<\/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>In this lesson we would go through how to create a Spring Starter Project. But first, we need to set up the Spring IDE. &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":42,"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":[8],"class_list":["post-29","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-spring-boot-tutorials","tag-spring-starter-project"],"_links":{"self":[{"href":"https:\/\/kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/posts\/29","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=29"}],"version-history":[{"count":3,"href":"https:\/\/kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/posts\/29\/revisions"}],"predecessor-version":[{"id":230,"href":"https:\/\/kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/posts\/29\/revisions\/230"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/media\/42"}],"wp:attachment":[{"href":"https:\/\/kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/media?parent=29"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/categories?post=29"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/tags?post=29"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}