{"id":106,"date":"2023-12-04T13:47:02","date_gmt":"2023-12-04T18:47:02","guid":{"rendered":"https:\/\/coding101.xyz\/?p=106"},"modified":"2023-12-21T12:52:30","modified_gmt":"2023-12-21T17:52:30","slug":"starter-spring-boot","status":"publish","type":"post","link":"https:\/\/coding101.xyz\/?p=106","title":{"rendered":"Starter Spring Boot"},"content":{"rendered":"\n<p>This is the pom.xml file with the starter packages for spring boot. <\/p>\n\n\n\n<!--more-->\n\n\n\n<p>Please ensure you got in the top application package a class annotated with @SpringBootApplication and that&#8217;s it. <\/p>\n\n\n\n<!-- HTML generated using hilite.me --><div style=\"background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;\"><table><tr><td><pre style=\"margin: 0; line-height: 125%\"> 1\n 2\n 3\n 4\n 5\n 6\n 7\n 8\n 9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36<\/pre><\/td><td><pre style=\"margin: 0; line-height: 125%\"><span style=\"color: #008080\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<\/span>\n<span style=\"color: #000080; font-weight: bold\">&lt;project<\/span> <span style=\"color: #FF0000\">xmlns=<\/span><span style=\"color: #0000FF\">&quot;http:\/\/maven.apache.org\/POM\/4.0.0&quot;<\/span> <span style=\"color: #FF0000\">xmlns:xsi=<\/span><span style=\"color: #0000FF\">&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot;<\/span>\n         <span style=\"color: #FF0000\">xsi:schemaLocation=<\/span><span style=\"color: #0000FF\">&quot;http:\/\/maven.apache.org\/POM\/4.0.0 https:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd&quot;<\/span><span style=\"color: #000080; font-weight: bold\">&gt;<\/span>\n    <span style=\"color: #000080; font-weight: bold\">&lt;modelVersion&gt;<\/span>4.0.0<span style=\"color: #000080; font-weight: bold\">&lt;\/modelVersion&gt;<\/span>\n    <span style=\"color: #000080; font-weight: bold\">&lt;parent&gt;<\/span>\n        <span style=\"color: #000080; font-weight: bold\">&lt;groupId&gt;<\/span>org.springframework.boot<span style=\"color: #000080; font-weight: bold\">&lt;\/groupId&gt;<\/span>\n        <span style=\"color: #000080; font-weight: bold\">&lt;artifactId&gt;<\/span>spring-boot-starter-parent<span style=\"color: #000080; font-weight: bold\">&lt;\/artifactId&gt;<\/span>\n        <span style=\"color: #000080; font-weight: bold\">&lt;version&gt;<\/span>3.2.0<span style=\"color: #000080; font-weight: bold\">&lt;\/version&gt;<\/span>\n        <span style=\"color: #000080; font-weight: bold\">&lt;relativePath\/&gt;<\/span> <span style=\"color: #008800; font-style: italic\">&lt;!-- lookup parent from repository --&gt;<\/span>\n    <span style=\"color: #000080; font-weight: bold\">&lt;\/parent&gt;<\/span>\n    <span style=\"color: #000080; font-weight: bold\">&lt;groupId&gt;<\/span>com.prod1<span style=\"color: #000080; font-weight: bold\">&lt;\/groupId&gt;<\/span>\n    <span style=\"color: #000080; font-weight: bold\">&lt;artifactId&gt;<\/span>appl<span style=\"color: #000080; font-weight: bold\">&lt;\/artifactId&gt;<\/span>\n    <span style=\"color: #000080; font-weight: bold\">&lt;version&gt;<\/span>0.0.1-SNAPSHOT<span style=\"color: #000080; font-weight: bold\">&lt;\/version&gt;<\/span>\n    <span style=\"color: #000080; font-weight: bold\">&lt;name&gt;<\/span>appl<span style=\"color: #000080; font-weight: bold\">&lt;\/name&gt;<\/span>\n    <span style=\"color: #000080; font-weight: bold\">&lt;description&gt;<\/span>Demo project for Spring Boot<span style=\"color: #000080; font-weight: bold\">&lt;\/description&gt;<\/span>\n    <span style=\"color: #000080; font-weight: bold\">&lt;properties&gt;<\/span>\n        <span style=\"color: #000080; font-weight: bold\">&lt;java.version&gt;<\/span>17<span style=\"color: #000080; font-weight: bold\">&lt;\/java.version&gt;<\/span>\n    <span style=\"color: #000080; font-weight: bold\">&lt;\/properties&gt;<\/span>\n    <span style=\"color: #000080; font-weight: bold\">&lt;dependencies&gt;<\/span>\n        <span style=\"color: #000080; font-weight: bold\">&lt;dependency&gt;<\/span>\n            <span style=\"color: #000080; font-weight: bold\">&lt;groupId&gt;<\/span>org.springframework.boot<span style=\"color: #000080; font-weight: bold\">&lt;\/groupId&gt;<\/span>\n            <span style=\"color: #008800; font-style: italic\">&lt;!-- for starting with web, use starter-web --&gt;<\/span>\n            <span style=\"color: #000080; font-weight: bold\">&lt;artifactId&gt;<\/span>spring-boot-starter<span style=\"color: #000080; font-weight: bold\">&lt;\/artifactId&gt;<\/span>\n        <span style=\"color: #000080; font-weight: bold\">&lt;\/dependency&gt;<\/span>\n    <span style=\"color: #000080; font-weight: bold\">&lt;\/dependencies&gt;<\/span>\n\n    <span style=\"color: #000080; font-weight: bold\">&lt;build&gt;<\/span>\n        <span style=\"color: #000080; font-weight: bold\">&lt;plugins&gt;<\/span>\n            <span style=\"color: #000080; font-weight: bold\">&lt;plugin&gt;<\/span>\n                <span style=\"color: #000080; font-weight: bold\">&lt;groupId&gt;<\/span>org.springframework.boot<span style=\"color: #000080; font-weight: bold\">&lt;\/groupId&gt;<\/span>\n                <span style=\"color: #000080; font-weight: bold\">&lt;artifactId&gt;<\/span>spring-boot-maven-plugin<span style=\"color: #000080; font-weight: bold\">&lt;\/artifactId&gt;<\/span>\n            <span style=\"color: #000080; font-weight: bold\">&lt;\/plugin&gt;<\/span>\n        <span style=\"color: #000080; font-weight: bold\">&lt;\/plugins&gt;<\/span>\n    <span style=\"color: #000080; font-weight: bold\">&lt;\/build&gt;<\/span>\n\n<span style=\"color: #000080; font-weight: bold\">&lt;\/project&gt;<\/span>\n<\/pre><\/td><\/tr><\/table><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Main class<\/h2>\n\n\n\n<!-- HTML generated using hilite.me --><div style=\"background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;\"><pre style=\"margin: 0; line-height: 125%\"><span style=\"color: #008800; font-weight: bold\">package<\/span> org<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">info1<\/span><span style=\"color: #333333\">;<\/span>\n\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>\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>\n\n<span style=\"color: #555555; font-weight: bold\">@SpringBootApplication<\/span>\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\">Main<\/span> <span style=\"color: #333333\">{<\/span>\n\n    <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>\n        SpringApplication<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">run<\/span><span style=\"color: #333333\">(<\/span>Main<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">class<\/span><span style=\"color: #333333\">,<\/span> args<span style=\"color: #333333\">);<\/span>\n    <span style=\"color: #333333\">}<\/span>\n\n<span style=\"color: #333333\">}<\/span>\n<\/pre><\/div>\n\n\n\n\n<p>Unless you want to add base package annotation to the SpringBootApplication, all the classes in the module must be at or under the main package where SpringBootApplication annotated class resides<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is the pom.xml file with the starter packages for spring boot.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-106","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/coding101.xyz\/index.php?rest_route=\/wp\/v2\/posts\/106","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/coding101.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/coding101.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/coding101.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/coding101.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=106"}],"version-history":[{"count":4,"href":"https:\/\/coding101.xyz\/index.php?rest_route=\/wp\/v2\/posts\/106\/revisions"}],"predecessor-version":[{"id":117,"href":"https:\/\/coding101.xyz\/index.php?rest_route=\/wp\/v2\/posts\/106\/revisions\/117"}],"wp:attachment":[{"href":"https:\/\/coding101.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=106"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/coding101.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=106"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/coding101.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=106"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}