Build the first spring boot project

I have been learning and using spring boot for a while, and now I will continue to summarize the relevant knowledge points in spring boot learning.


The purpose of the design is to simplify the initial construction and development process of the new Spring application.
It provides a fixed framework of convention over configuration style for Spring ecosystem.
Out of the box, no code generation, no XML configuration required. You can also modify the default values to meet specific needs.

Environmental preparation

  1. jdk1.8+
  2. maven 3.0+
  3. IDEA

Construction steps

    -Open IDEA
    - New Project
    - Spring Initializr => next
    -Fill in group, artifact - > hook up Web (open web function)
    - next

engineering structure

    - src
                - statics
                - templates
                - application.yml
    - pom
  • pom file is the basic dependency management file
  • Resources file
    • Static resources
    • templates resources
    • application.yml configuration file
  • The entry of SpringbootApplication program & startup class

pom.xml configuration

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="" 


    <description>Demo project for Spring Boot</description>

        <relativePath/> <!-- lookup parent from repository -->





Test Demo

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

 *  test case
 * @author
 * @create 2018-01-05 11:32

public class DemoController {

    String index() {
        return "Hello World!";

Then start the main method of SpringbootApplication, open the browser localhost:8080/hello, and the browser displays

Hello World!

Pass the test~

Tags: Java Spring Maven SpringBoot xml

Posted on Sun, 03 May 2020 22:43:06 -0400 by HockeyDevil07