Introduction
Spring Boot is a new framework provided by the Pivotal team. It is designed to simplify the initial construction and development process of new Spring applications. The framework uses an ad hoc approach to configuration, eliminating the need for developers to define boilerplate configurations. In this way, Spring Boot strives to become a leader in the booming field of rapid application development.
In previous spring projects, we would face a lot of tedious configurations, and basically use them with a lot of copy and paste. Spring Boot allows us to easily and quickly build Spring Web applications without excessive configuration. It can be used out of the box without code generation or XML configuration, allowing us to quickly use the spring framework.
Start
Version: java 1.8.0_51 & spring boot 1.5.4
1. Build a simple spring boot project
The generator SPRING INITIALIZR provided on the official website here is used to create a simple spring boot project.
1. Visit http://start.spring.io

Options: Project (maven) Language (java) SpringBoot version (1.5.4)
Group fills in the group name, Artifact fills in the module name, Dependencies on the right side can select the corresponding dependencies, because we want to build a web project, so we can add web dependencies.
Click Generate Project to generate the download project.
2. Import the downloaded maven project into the IDE and run it
Extract the downloaded project and import it into the IDE (IntelliJ IDEA is used here)
As follows:

Directly run the main method of DemoApplication.java.
Screenshot of successful operation:

You can see that the process ID of the project is: 25642, and you can view the detailed information through java's jconsole tool.
You can see that the startup port of the project is 8080 (spring boot default port, which can be modified in application.properties)

2. pom.xml Explain
Open the pom.xml file and view the configuration information
Inherit the parent module. The spring-boot-starter-parent module contains automatic configuration, logs and YAML (reference:), so Building spring projects becomes easy.
<!-- 继承 spring boot 父包--> <parent> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-parent</artifactid> <version>1.5.4.RELEASE</version> <relativepath></relativepath> <!-- lookup parent from repository --> </parent>
pom.xml relies on the spring-boot-starter-web module, including Tomcat and spring-webmvc (reference:). There is no need to specify the version because the parent module already has the default configuration. If needed Specified versions can be added.
<!-- 构建web项目模块 包括了Tomcat和spring-webmvc -->
<!-- spring-boot-starter-web 默认依赖了tomcat的starter 所以使得项目可以直接运行而不需要部署到tomcat中-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>pom.xml depends on the spring-boot-starter-test test module, including JUnit, Hamcrest, Mockito
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>In spring-boot, module dependencies They are all done in the starter format and named in the spring-boot-starter- format, with indicating the specific module. The spring-boot ecosystem provides a wealth of starters for developers to use (reference:)
This modular dependency simplifies a large number of dependency configurations. Using the starter dependency method, you can depend on the corresponding dependent packages into the project together, unlike traditional Spring which requires separate dependent packages.
For example, the web module in spring-boot needs to rely on web service packages such as org.springframework spring-web in traditional Spring configuration. In spring-boot, it only needs to rely on spring-boot-starter- The web can depend on the corresponding packages, greatly simplifying the configuration.
Supplementary
The above explains that the spring-boot project can be built directly from http://start.spring.io
The following explains directly in IntelliJ IDEA Build the spring-boot project
1. Open IDEA and create a new project

2. Select Spring Initializr and fill in https:// in Choose Initializr Service URL. start.spring.io, click Next



The above is the detailed content of Build a simple spring boot project example. For more information, please follow other related articles on the PHP Chinese website!
How do I use Maven or Gradle for advanced Java project management, build automation, and dependency resolution?Mar 17, 2025 pm 05:46 PMThe article discusses using Maven and Gradle for Java project management, build automation, and dependency resolution, comparing their approaches and optimization strategies.
How do I create and use custom Java libraries (JAR files) with proper versioning and dependency management?Mar 17, 2025 pm 05:45 PMThe article discusses creating and using custom Java libraries (JAR files) with proper versioning and dependency management, using tools like Maven and Gradle.
How do I implement multi-level caching in Java applications using libraries like Caffeine or Guava Cache?Mar 17, 2025 pm 05:44 PMThe article discusses implementing multi-level caching in Java using Caffeine and Guava Cache to enhance application performance. It covers setup, integration, and performance benefits, along with configuration and eviction policy management best pra
How can I use JPA (Java Persistence API) for object-relational mapping with advanced features like caching and lazy loading?Mar 17, 2025 pm 05:43 PMThe article discusses using JPA for object-relational mapping with advanced features like caching and lazy loading. It covers setup, entity mapping, and best practices for optimizing performance while highlighting potential pitfalls.[159 characters]
How does Java's classloading mechanism work, including different classloaders and their delegation models?Mar 17, 2025 pm 05:35 PMJava's classloading involves loading, linking, and initializing classes using a hierarchical system with Bootstrap, Extension, and Application classloaders. The parent delegation model ensures core classes are loaded first, affecting custom class loa


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Atom editor mac version download
The most popular open source editor

Dreamweaver CS6
Visual web development tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function







