<div dir="ltr" style="text-align: justify;" trbidi="on">
<div style="font-family: calibri, sans-serif; text-align: justify;">
<div style="font-size: 12pt;">
<div style="font-size: 12pt;">Hello friends lets discuss another way to create spring boot project structure by using Spring Boot Initializr. Spring Boot Initializr is used to quick start new Spring Boot Maven/Gradle projects within no time. It generates initial project structure and builds scripts to reduce Development time.</div>
<div style="font-size: 12pt;">
</div>
<div style="font-size: 12pt;">As previous chapter we have seen following ways for Spring Boot Initialzr.</div>
<div style="font-size: 12pt;">
</div>
<ul style="font-size: 12pt;">
<li><a href="https://dineshonjava.com/2016/06/spring-boot-initilizr-web-interface-and-examples.html"><b>Spring Boot Initilizr through Web Interface</b></a></li>
<li><a href="https://dineshonjava.com/2016/06/spring-boot-initilizr-with-ides-via-spring-tool-suite.html"><b>Spring Boot Initilizr through IDEs/IDE Plugins</b></a></li>
<li><b>Spring Boot Initilizr through Spring Boot CLI</b></li>
</ul>
<div style="font-size: 12pt;">
</div>
<div style="font-size: 12pt;">Before starting discussion for this tutorial we have to go through my previous chapter <b>(<a href="https://dineshonjava.com/2016/06/spring-boot-cli-installation-and-hello-world-example.html">Spring Boot CLI installation and Hello World Example</a>)</b> for Basic and Installation guide for Spring Boot CLI. As in previous chapter we saw, the Spring Boot CLI is a great way to develop Spring applications by just writing code. However, the Spring Boot CLI also has a few commands that can help us use the Initializr to kick-start development on a more traditional Java project.</div>
<div style="font-size: 12pt;">
</div>
<div style="font-size: 12pt;">Spring Boot CLI provides a “<b>spring init</b>” command to bootstrap Spring Applications.</div>
<div style="font-size: 12pt;">
</div>
<div style="font-size: 12pt;"><b>Syntax for Init Command:</b></div>
<div style="font-size: 12pt;"><b><br />
</b> <i>spring init [options] [location]</i></div>
<div style="font-size: 12pt;">
</div>
<div style="font-size: 12pt;">Here “<b>options</b>” are command options and “<b>location</b>” is specified our file system location to create new Spring Boot Project. </div>
<div style="font-size: 12pt;">
</div>
<div style="font-size: 12pt;">
<div align='center' id="ads-id"></div>
</div>
<div style="font-size: 12pt;"><b>Examples for Spring Init Command:</b></div>
<div style="font-size: 12pt;">
</div>
<div style="font-size: 12pt;"><b>Example 1: Use default setting</b></div>
<div style="font-size: 12pt;"><i><br />
</i> <i>$ spring init</i></div>
<div style="font-size: 12pt;">
</div>
<div style="font-size: 12pt;">
</div>
<div style="font-size: 12pt;">After contacting the Initializr web application, the init command will conclude by downloading a <b>demo.zip</b> file with following default setting. </div>
<div style="font-size: 12pt;">
</div>
<ul style="font-size: 12pt;">
<li>Default Build tool is “<b>maven</b>”.</li>
<li>Default Spring Initilizr service target URL:<b><i> https://start.spring.io</i></b></li>
<li>Default project name: “<b>demo</b>”</li>
<li>Default maven type: “<b>jar</b>”</li>
<li>Default only baseline starter dependencies for <b>Spring Boot</b> and <b>testing</b></li>
</ul>
<div style="font-size: 12pt;">
</div>
<div style="font-size: 12pt;"><b>Example 2: Using required dependencies on web project</b></div>
<div style="font-size: 12pt;">Let’s say you want to start out by building a web application that uses JPA for data persistence and that’s secured with Spring Security. You can specify those initial dependencies with either <b>&#8211;dependencies</b> or <b>-d</b>:</div>
<div style="font-size: 12pt;">
</div>
<div style="font-size: 12pt;"><i>$ spring init –dweb, jpa, security</i></div>
<div style="font-size: 12pt;">
</div>
<div style="font-size: 12pt;">This will give you a demo.zip containing the same project structure as before, but with Spring Boot’s web, JPA, and security starters expressed as dependencies in<b> pom.xml</b>.</div>
<div style="font-size: 12pt;">
</div>
<div style="font-size: 12pt;"><b>Example 3: Using required dependencies on web project with change Build (Maven to Gradle)</b></div>
<div style="font-size: 12pt;">
</div>
<div style="font-size: 12pt;"><b>For Gradle</b></div>
<div style="font-size: 12pt;"><i>$ spring init –dweb, jpa, security –build gradle</i></div>
<div style="font-size: 12pt;">
</div>
<div style="font-size: 12pt;"><b>For Maven</b></div>
<div style="font-size: 12pt;"><i>$ spring init –dweb, jpa, security –build maven</i> (maven is default build type)</div>
<div style="font-size: 12pt;">
</div>
<div style="font-size: 12pt;"><b>Example 4: Change packaging</b></div>
<div style="font-size: 12pt;">By default, the build specification for both Maven and Gradle builds will produce an executable JAR file. If you’d rather produce a WAR file, you can specify so with the <b>&#8211;packaging</b> or <b>-p </b>parameter:</div>
<div style="font-size: 12pt;">
</div>
<div style="font-size: 12pt;"><i>$ spring init –dweb, jpa, security –build gradle –p war</i></div>
<div style="font-size: 12pt;">
</div>
<div style="font-size: 12pt;"><b>Example 5: Change application name</b></div>
<div style="font-size: 12pt;">
</div>
<div style="font-size: 12pt;"><i>$ spring init –dweb, jpa, security –build gradle –p war myapp.zip</i></div>
<div style="font-size: 12pt;">
</div>
<div style="font-size: 12pt;"><b>Example 6: Specifying the Java version to compile with, and selecting a version of Spring Boot</b></div>
<div style="font-size: 12pt;">
</div>
<div style="font-size: 12pt;"><i>$ spring init –dweb, jpa, security –build gradle &#8211;java-version=1.7 &#8211;boot-version=1.3.0.RELEASE –p war myapp.zip</i></div>
<div style="font-size: 12pt;">
</div>
<div style="font-size: 12pt;"><b>Other more commands</b></div>
<div style="font-size: 12pt;">We can discover all of the parameters by using the help command:</div>
<div style="font-size: 12pt;">
</div>
<div style="font-size: 12pt;"><i>$ spring help init</i></div>
<div style="font-size: 12pt;">
</div>
<div style="font-size: 12pt;">For lists several parameters that are supported by the Initializr.</div>
<div style="font-size: 12pt;">
</div>
<div style="font-size: 12pt;"><i>spring init -l ;</i></div>
<div style="font-size: 12pt;">
</div>
<p><b>Summary</b></p>
<div style="font-size: 12pt;">Whether we use Initializr’s web-based interface, create our projects from Spring Tool Suite, or use the Spring Boot CLI to initialize a project, projects created using the Spring Boot Initializr have a familiar project layout, not unlike other Java projects we may have developed before.</div>
<p></p>
<div style="background-color: #f2f9fc; border-radius: 3px; border: 1px solid #c9e6f2; line-height: 1.45; padding: 16px;"><b>Spring Boot Related Topics</b></p>
<ol style="text-align: left;">
<li><b><a href="https://dineshonjava.com/2017/04/spring-boot-interview-questions-and-answers.html">Spring Boot Interview Questions and Answers</a></b></li>
<li><b><a href="https://dineshonjava.com/2016/06/introduction-to-spring-boot-a-spring-boot-complete-guide.html">Introduction to Spring Boot</a></b></li>
<li><a href="https://dineshonjava.com/2016/06/essentials-key-components-and-internals-of-spring-boot-framework.html"><b>Essentials and Key Components of Spring Boot</b></a></li>
<li><a href="https://dineshonjava.com/2016/06/spring-boot-cli-installation-and-hello-world-example.html"><b>Spring Boot CLI Installation and Hello World Example</b></a></li>
<li><a href="https://dineshonjava.com/2016/06/spring-boot-initilizr-web-interface-and-examples.html"><b>Spring Boot Initializr Web Interface</b></a></li>
<li><a href="https://dineshonjava.com/2016/06/spring-boot-initilizr-with-ides-via-spring-tool-suite.html"><b>Spring Boot Initializr With IDEs</b></a></li>
<li><a href="https://dineshonjava.com/2016/07/installing-spring-boot.html"><b>Installing Spring Boot</b></a></li>
<li><a href="https://dineshonjava.com/2016/07/developing-your-first-spring-boot-application-hello-world.html"><b>Developing your first Spring Boot application</b></a></li>
<li><a href="https://dineshonjava.com/2016/07/customizing-spring-boot-auto-configuration.html"><b>External Configurations for Spring Boot Applications</b></a></li>
<li><a href="https://dineshonjava.com/2016/07/logging-configuration-in-spring-boot.html"><b>Logging Configuration in Spring Boot</b></a></li>
<li><a href="https://dineshonjava.com/2016/07/spring-boot-with-spring-mvc-application.html"><b>Spring Boot and Spring MVC</b></a></li>
<li><a href="https://dineshonjava.com/2016/08/working-with-sql-databases-in-spring-boot-application.html"><b>Working with SQL Databases and Spring Boot</b></a></li>
<li><a href="https://dineshonjava.com/2016/08/mysql-configuration-with-spring-boot.html"><b>MySQL Configurations</b></a></li>
<li><a href="https://dineshonjava.com/2016/08/spring-data-jpa-using-in-spring-boot-application.html"><b>Spring Data JPA using Spring Boot Application</b></a></li>
<li><a href="https://dineshonjava.com/2016/08/spring-boot-with-nosql-technologies.html"><b>Spring Boot with NoSQL technologies</b></a></li>
<li><a href="https://dineshonjava.com/2016/08/spring-cache-tutorial.html"><b>Spring Cache Tutorial</b></a></li>
<li><a href="https://dineshonjava.com/2016/08/spring-security-tutorial-using-spring-boot.html"><b>Spring Security Tutorial with Spring Boot</b></a></li>
<li><a href="https://dineshonjava.com/2016/08/spring-boot-and-mongodb-in-rest-application.html"><b>Spring Boot and MongoDB in REST Application</b></a></li>
<li><b><a href="https://dineshonjava.com/2016/08/spring-boot-actuator-complete-guide.html">Complete Guide for Spring Boot Actuator</a></b></li>
<li><b><a href="https://dineshonjava.com/2017/01/microservices-with-spring-boot.html">Microservices with Spring Boot</a></b>
</li>
</ol>
</div>
<p></p>
<div style="font-size: 12pt;">Happy Spring Boot Learning :)</p>
<p>
</div>
</div>
</div>
</div>
<div class="wp-post-navigation"> 
									 <div class="wp-post-navigation-pre"> 
									 <a href="https://dineshonjava.com/spring-boot-initilizr-with-ides-via-spring-tool-suite/">Previous</a> 
									 </div> 
									 <div class="wp-post-navigation-next"> 
									 <a href="https://dineshonjava.com/installing-spring-boot/">Next</a> 
									 </div> 
									</div>
<script type="text/javascript">
jQuery(document).ready(function($) {
 $.post('https://dineshonjava.com/wp-admin/admin-ajax.php', {action: 'mts_view_count', id: '142'});
});
</script>
Strategy Design Patterns We can easily create a strategy design pattern using lambda. To implement…
Decorator Pattern A decorator pattern allows a user to add new functionality to an existing…
Delegating pattern In software engineering, the delegation pattern is an object-oriented design pattern that allows…
Technology has emerged a lot in the last decade, and now we have artificial intelligence;…
Managing a database is becoming increasingly complex now due to the vast amount of data…
Overview In this article, we will explore Spring Scheduler how we could use it by…