<div dir="ltr" style="text-align: justify;">
<div style="text-align: justify;">
<div style="font-size: 12pt;">
<div style="font-family: calibri, sans-serif; font-size: 12pt;">Hello friends lets discuss another important components Spring Boot Initializr of Spring Boot, it is a quick way to create spring boot project structure. In this chapter we are going to explore about a web interface which create Spring Boot Application online.</div>
<div style="font-family: calibri, sans-serif; font-size: 12pt;"></div>
<div style="font-family: calibri, sans-serif; font-size: 12pt;">Related tutorials previously we have discussed</div>
<ul style="font-family: calibri, sans-serif; font-size: 12pt; text-align: left;">
<li><b><a href="https://dineshonjava.com/introduction-to-spring-boot-a-spring-boot-complete-guide/">Introduction of Spring Boot</a> </b></li>
<li><b><a href="https://dineshonjava.com/essentials-key-components-and-internals-of-spring-boot-framework/">Key Components of Spring Boot</a> </b></li>
<li><a href="https://dineshonjava.com/spring-boot-cli-installation-and-hello-world-example/"><b>Spring Boot CLI</b></a></li>
</ul>
<div style="font-family: calibri, sans-serif; font-size: 12pt;">
<div id="ads-id" align="center"></div>
</div>
<div style="font-family: calibri, sans-serif; font-size: 12pt;"><b>What is Spring Boot Initializr?</b></div>
<div style="font-family: calibri, sans-serif; font-size: 12pt;">The Spring Initializr is ultimately a <b>web application</b> (at “<b>http://start.spring.io/</b>”) that can generate a Spring Boot project structure for you. It doesn’t generate any application code, but it will give you a basic project structure and either a <b>Maven </b>or a <b>Gradle </b>build specification to build your code with.</div>
<div style="font-family: calibri, sans-serif; font-size: 12pt;"></div>
<div style="font-family: calibri, sans-serif; font-size: 12pt;"><b>Spring Initializr can be used in several ways:</b></div>
<ul style="font-family: calibri, sans-serif; font-size: 12pt;">
<li>Through a web-based interface</li>
<li>Via Spring Tool Suite</li>
<li>Via IntelliJ IDEA</li>
<li>Using the Spring Boot CLI</li>
</ul>
<div style="font-family: calibri, sans-serif; font-size: 12pt;"><b>Why we need Spring Boot Initializr?</b></div>
<div style="font-family: calibri, sans-serif; font-size: 12pt;">Sometimes the hardest part of a project is getting started. You need to set up a directory structure for various project artifacts, create a build file, and populate the build file with dependencies. The <b><a href="https://dineshonjava.com/2016/06/spring-boot-cli-installation-and-hello-world-example.html#.V2xPAfl97IV">Spring Boot CLI</a></b> removes much of this setup work, but if you favor a more traditional Java project structure, you’ll want to look at the Spring Initializr.</div>
<div style="font-family: calibri, sans-serif; font-size: 12pt;"></div>
<div style="font-family: calibri, sans-serif; font-size: 12pt;"><b>USING SPRING INITIALIZR’S WEB INTERFACE</b></div>
<div style="font-family: calibri, sans-serif; font-size: 12pt;">Now we are starting with the web-based interface.</div>
<div style="font-family: calibri, sans-serif; font-size: 12pt;"></div>
<div style="font-family: calibri, sans-serif; font-size: 12pt;">The Spring Team has provided a Web Interface for Spring Boot Initializr at “<b>http://start.spring.io/</b>”. We can use it to create our new Project’s base structure for Maven/Gradle build tools.</div>
<div style="font-family: calibri, sans-serif; font-size: 12pt;"></div>
<div class="separator" style="clear: both; font-family: calibri, sans-serif; font-size: 12pt; text-align: center;"><img src="https://dineshonjava.com/wp-content/uploads/2016/06/Spring-Boot-Initialzr-Web-Interface.jpg" width="640" height="371" border="0" /></div>
<div style="font-family: calibri, sans-serif; font-size: 12pt;"></div>
<div style="font-family: calibri, sans-serif; font-size: 12pt;"><b>Creating Maven Example with Spring Boot Initializr Web Interface</b></div>
<div style="font-family: calibri, sans-serif; font-size: 12pt;">There are following steps to create new Spring Boot Web Application for Maven Build tool and Spring STS Suite IDE.</div>
<div style="font-family: calibri, sans-serif; font-size: 12pt;"></div>
<div style="font-family: calibri, sans-serif; font-size: 12pt;"><b>Step 1:</b> Go to Spring Boot Initializr at “<b>http://start.spring.io/</b>”.</div>
<div style="font-family: calibri, sans-serif; font-size: 12pt;"><b><br />
</b> <b>Step 2:</b> Once you’ve filled in the form and made your dependency selections, click the Generate Project button to have Spring Initializr generate a project for you.</div>
<div style="font-family: calibri, sans-serif; font-size: 12pt;"><b> </b></div>
<div class="separator" style="clear: both; font-family: calibri, sans-serif; font-size: 12pt; text-align: center;"><img src="https://dineshonjava.com/wp-content/uploads/2016/06/Spring-Boot-Initialzr-Web-Interface-myapp.jpg" width="640" height="299" border="0" /></div>
<div style="font-family: calibri, sans-serif; font-size: 12pt;"><b><br />
</b> <b>Step 3: </b>Now click on “<b>Generate Project</b>” Button, it creates and downloads a Maven Project as “<b>myapp.zip</b>” file into our local file system.</div>
<div style="font-family: calibri, sans-serif; font-size: 12pt;"><b><br />
</b> <b>Step 4: </b>Move “<b>myapp.zip</b>” to our Spring STS Suite Workspace and Extract this zip file</div>
<div style="font-family: calibri, sans-serif; font-size: 12pt;"></div>
<div class="separator" style="clear: both; font-family: calibri, sans-serif; font-size: 12pt; text-align: center;"><img src="https://dineshonjava.com/wp-content/uploads/2016/06/Spring-Boot-Initialzr-Web-Interface-myapp-unpack.png" border="0" /></div>
<div style="font-family: calibri, sans-serif; font-size: 12pt;"></div>
<div style="font-family: calibri, sans-serif; font-size: 12pt;"><b>Step 5:</b> Import this “myapp” Maven project into Spring STS IDE.</div>
<div style="font-family: calibri, sans-serif; font-size: 12pt;"></div>
<div style="font-family: calibri, sans-serif; font-size: 12pt;"><b>Step 6: </b>We’d have a project structure similar.</div>
<div style="font-family: calibri, sans-serif; font-size: 12pt;"></div>
<div class="separator" style="clear: both; font-family: calibri, sans-serif; font-size: 12pt; text-align: center;"><img src="https://dineshonjava.com/wp-content/uploads/2016/06/Spring-Boot-Initialzr-Web-Interface-myapp-project-structure.jpg" border="0" /></div>
<div style="font-family: calibri, sans-serif; font-size: 12pt;"></div>
<div style="font-family: calibri, sans-serif; font-size: 12pt;">If you observe this project files, it generates <b>pom.xml</b> file, two Spring Boot Java files and one JUnit Java file.</div>
<pre class="highlight" style="font-size: 12pt;"><;?xml version="1.0" encoding="UTF-8"?>; 
<;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">; 
 <;modelVersion>;4.0.0<;/modelVersion>; 
 
 <;groupId>;com.dineshonjava<;/groupId>; 
 <;artifactId>;myapp<;/artifactId>; 
 <;version>;0.0.1-SNAPSHOT<;/version>; 
 <;packaging>;jar<;/packaging>; 
 
 <;name>;myapp<;/name>; 
 <;description>;Demo project for Spring Boot<;/description>; 
 
 <;parent>; 
 <;groupId>;org.springframework.boot<;/groupId>; 
 <;artifactId>;spring-boot-starter-parent<;/artifactId>; 
 <;version>;1.3.5.RELEASE<;/version>; 
 <;relativePath/>; <;!-- lookup parent from repository -->; 
 <;/parent>; 
 
 <;properties>; 
 <;project.build.sourceEncoding>;UTF-8<;/project.build.sourceEncoding>; 
 <;java.version>;1.8<;/java.version>; 
 <;/properties>; 
 
 <;dependencies>; 
 <;dependency>; 
 <;groupId>;org.springframework.boot<;/groupId>; 
 <;artifactId>;spring-boot-starter-data-jpa<;/artifactId>; 
 <;/dependency>; 
 <;dependency>; 
 <;groupId>;org.springframework.boot<;/groupId>; 
 <;artifactId>;spring-boot-starter-web<;/artifactId>; 
 <;/dependency>; 
 
 <;dependency>; 
 <;groupId>;org.springframework.boot<;/groupId>; 
 <;artifactId>;spring-boot-starter-test<;/artifactId>; 
 <;scope>;test<;/scope>; 
 <;/dependency>; 
 <;/dependencies>; 
 
 <;build>; 
 <;plugins>; 
 <;plugin>; 
 <;groupId>;org.springframework.boot<;/groupId>; 
 <;artifactId>;spring-boot-maven-plugin<;/artifactId>; 
 <;/plugin>; 
 <;/plugins>; 
 <;/build>; 
 
 
<;/project>; 
</pre>
<div style="font-size: 12pt;"></div>
<div style="font-size: 12pt;"><b><u>MyappApplication.java</u></b></div>
<div style="font-size: 12pt;"></div>
<pre class="highlight" style="font-size: 12pt;">package com.dineshonjava; 
 
import org.springframework.boot.SpringApplication; 
import org.springframework.boot.autoconfigure.SpringBootApplication; 
 
@SpringBootApplication 
public class MyappApplication { 
 
 public static void main(String[] args) { 
 SpringApplication.run(MyappApplication.class, args); 
 } 
} 
 
</pre>
<div style="font-size: 12pt;"></div>
<div style="font-size: 12pt;"><b><u>MyappApplicationTests.java</u></b></div>
<pre class="highlight" style="font-size: 12pt;">package com.dineshonjava; 
 
import org.junit.Test; 
import org.junit.runner.RunWith; 
import org.springframework.boot.test.SpringApplicationConfiguration; 
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 
import org.springframework.test.context.web.WebAppConfiguration; 
 
@RunWith(SpringJUnit4ClassRunner.class) 
@SpringApplicationConfiguration(classes = MyappApplication.class) 
@WebAppConfiguration 
public class MyappApplicationTests { 
 
 @Test 
 public void contextLoads() { 
 } 
 
} 
</pre>
<div style="font-size: 12pt;"></div>
<div style="font-size: 12pt;"><b>Creating Gradle Example with Spring Boot Initializr Web Interface</b></div>
<div style="font-size: 12pt;">
<p>All steps for creating gradle project with Spring Boot Initializr is same as like Maven Project as we have created above unlike select <b>Gradle Project</b> instead of <b>Maven Project</b> in Spring Boot Initializr Web Interface.</p>
</div>
<div class="separator" style="clear: both; font-size: 12pt; text-align: center;"><img src="https://dineshonjava.com/wp-content/uploads/2016/06/Spring-Boot-Initialzr-Web-Interface-gradle.png" width="640" height="299" border="0" /></div>
<div style="font-size: 12pt;"></div>
<div style="font-size: 12pt;">All source code files name and structure of project is also same as like maven project unlike creating build file name <b>build.gradle</b> instead of <b>pom.xml</b></div>
<div style="font-size: 12pt;"></div>
<div class="separator" style="clear: both; font-size: 12pt; text-align: center;"><img src="https://dineshonjava.com/wp-content/uploads/2016/06/gradle-project.png" border="0" /></div>
<div style="font-size: 12pt;"></div>
<div style="font-size: 12pt;"><b>build.gradle</b></div>
<pre class="highlight" style="font-size: 12pt;">buildscript { 
 ext { 
 springBootVersion = '1.3.5.RELEASE' 
 } 
 repositories { 
 mavenCentral() 
 } 
 dependencies { 
 classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") 
 } 
} 
 
apply plugin: 'java' 
apply plugin: 'eclipse' 
apply plugin: 'spring-boot' 
 
jar { 
 baseName = 'mygradleapp' 
 version = '0.0.1-SNAPSHOT' 
} 
sourceCompatibility = 1.8 
targetCompatibility = 1.8 
 
repositories { 
 mavenCentral() 
} 
 
 
dependencies { 
 compile('org.springframework.boot:spring-boot-starter-data-jpa') 
 compile('org.springframework.boot:spring-boot-starter-web') 
 testCompile('org.springframework.boot:spring-boot-starter-test') 
} 
 
 
eclipse { 
 classpath { 
 containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER') 
 containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8' 
 } 
} 
 
</pre>
<div style="font-size: 12pt;"></div>
<div style="font-size: 12pt;">As you can see, there’s very little code in this project. Aside from a couple of empty directories, it also includes the following:</div>
<div style="font-size: 12pt;"></div>
<ul>
<li><b>build.gradle</b>—A Gradle build specification. Had you chosen a Maven project, this would be replaced with pom.xml.</li>
<li><b>Application.java</b>—A class with a main() method to bootstrap the application.</li>
<li><b>ApplicationTests.java</b>— an empty JUnit test class instrumented to load a Spring application context using Spring Boot auto-configuration.</li>
<li><b>application.properties</b>—an empty properties file for you to add configuration properties to as you see fit.</li>
</ul>
<p> ;</p>
<div style="font-size: 12pt;"></div>
<p><b>Summary</b></p>
<div style="font-size: 12pt;">Whether you use Initializr’s web-based interface, create your 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 you may have developed before.</div>
<div style="font-size: 12pt;"></div>
<div style="font-size: 12pt;">Spring Boot is an exciting new way to develop Spring applications with minimal friction from the framework itself. Auto-configuration eliminates much of the boilerplate configuration that infests traditional Spring applications. Spring Boot starters enable you to specify build dependencies by what they offer rather than use explicit library names and version. The Spring Boot CLI takes Spring Boot’s frictionless development model to a whole new level by enabling quick and easy development with Groovy from the command line. And the Actuator lets you look inside your running application to see what and how Spring Boot has done.</div>
<div style="font-size: 12pt;"></div>
<div style="font-size: 12pt;"></div>
<div style="font-size: 12pt;">
<p>Happy Spring Boot Learning!!!</p>
<div style="background-color: #f2f9fc; border-radius: 3px; border: 1px solid #c9e6f2; line-height: 1.45; padding: 16px;">
<p><b>Spring Boot Related Topics</b></p>
<ol style="text-align: left;">
<li><b><a href="https://dineshonjava.com/introduction-to-spring-boot-a-spring-boot-complete-guide/">Introduction to Spring Boo</a>t</b></li>
<li><a href="https://dineshonjava.com/essentials-key-components-and-internals-of-spring-boot-framework/"><b>Essentials and Key Components of Spring Boot</b></a></li>
<li><a href="https://dineshonjava.com/spring-boot-cli-installation-and-hello-world-example/"><b>Spring Boot CLI Installation and Hello World Example</b></a></li>
<li><a href="https://dineshonjava.com/spring-boot-initilizr-web-interface-and-examples/"><b>Spring Boot Initializr Web Interface</b></a></li>
<li><a href="https://dineshonjava.com/spring-boot-initilizr-with-ides-via-spring-tool-suite/"><b>Spring Boot Initializr With IDEs</b></a></li>
<li><a href="https://dineshonjava.com/spring-boot-initializr-with-spring-boot-cli/"><b>Spring Boot Initializr With Spring Boot CLI</b></a></li>
<li><a href="https://dineshonjava.com/installing-spring-boot/"><b>Installing Spring Boot</b></a></li>
<li><a href="https://dineshonjava.com/developing-your-first-spring-boot-application-hello-world/"><b>Developing your first Spring Boot application</b></a></li>
<li><a href="https://dineshonjava.com/customizing-spring-boot-auto-configuration/"><b>External Configurations for Spring Boot Applications</b></a></li>
<li><a href="https://dineshonjava.com/logging-configuration-in-spring-boot/"><b>Logging Configuration in Spring Boot</b></a></li>
<li><a href="https://dineshonjava.com/spring-boot-with-spring-mvc-application/"><b>Spring Boot and Spring MVC</b></a></li>
<li><a href="https://dineshonjava.com/working-with-sql-databases-in-spring-boot-application/"><b>Working with SQL Databases and Spring Boot</b></a></li>
<li><a href="https://dineshonjava.com/mysql-configuration-with-spring-boot/"><b>MySQL Configurations</b></a></li>
<li><a href="https://dineshonjava.com/spring-data-jpa-using-in-spring-boot-application/"><b>Spring Data JPA using Spring Boot Application</b></a></li>
<li><a href="https://dineshonjava.com/spring-boot-with-nosql-technologies/"><b>Spring Boot with NoSQL technologies</b></a></li>
<li><a href="https://dineshonjava.com/spring-cache-tutorial/"><b>Spring Cache Tutorial</b></a></li>
<li><a href="https://dineshonjava.com/spring-security-tutorial-using-spring-boot/"><b>Spring Security Tutorial with Spring Boot</b></a></li>
<li><a href="https://dineshonjava.com/spring-boot-and-mongodb-in-rest-application/"><b>Spring Boot and MongoDB in REST Application</b></a></li>
<li><b><a href="https://dineshonjava.com/spring-boot-actuator-complete-guide/">Complete Guide for Spring Boot Actuator</a></b></li>
<li><b><a href="https://dineshonjava.com/microservices-with-spring-boot/">Microservices with Spring Boot</a></b></li>
</ol>
</div>
</div>
</div>
</div>
</div>
<div class="wp-post-navigation"> 
									 <div class="wp-post-navigation-pre"> 
									 <a href="https://dineshonjava.com/spring-boot-cli-installation-and-hello-world-example/">Previous</a> 
									 </div> 
									 <div class="wp-post-navigation-next"> 
									 <a href="https://dineshonjava.com/spring-boot-initilizr-with-ides-via-spring-tool-suite/">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: '144'});
});
</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…