1. What is Spring Boot

What is Spring Boot?

Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can “just run”.

Spring Boot is very simple and easy to use, requiring only a small amount of configuration to quickly start an application development environment, developers can put more time and effort into the specific business logic.

Using Spring Boot and reading this article requires basic Java syntax (required), and some network knowledge (HTTP)

It uses convention over configuration, and itself uses a set of default configurations. Developers only need to relate to the parts of the project that need to be modified, and they do not need to organize and care about all configurations.

  1. Initialize the Spring Boot project

Here we use IDEA as a development tool, mainly through IDEA initialization. You can also initialize start.spring. IO /.

First IEDA opens the New Project screen and selects Spring Initializr. Project SDK select the SDK version you want to use, I use Java8, other items can keep the default, directly to the next step

Next you can set up some basic information about the project, focusing on Groups and Artifacts, as well as Java Version items. Groups and artifacts together are packages, which can take the form of inverted domain names. Com.xxx.xxx, or use com. company name/personal name. Project name. Just make sure the Package is unique. Pay attention to the language options and choose according to your needs, usually using Java. Java Version Select the Java version you want.

After setting the basic information of the project, now choose the project dependencies. According to the actual dependencies of the project, you can also choose the learning project by clicking on mine first.Finally, click Next, select the project storage directory, and click Finish to complete the project creation.

  1. Run the Spring Boot project

In the project of SRC/main/Java/com. XXX. XXX/(com. XXX. XXX, replace with their own package name, the same below) to create a new folder, named controller, or in the IDEA, right-click on the com. XXX. XXX, Select new -> Package named com.xxx.xxx.controller, then create a new hello.java file in controller and type the following:


@RestController
public class Hello {

    @GetMapping("/hello")
    public String hello(a) {
        return "hello,world!"; }}Copy the code

Click the small triangle in the upper right corner of IDEA to start the project.

If everything is ok, the browser to http://localhost:8080/hello can see page displays the hello, world! “, since then, the project construction started to complete. You can change the return value of hello, restart the project and refresh the page to see the return value, and modify the @getMapping parentheses to see how the browser URL is associated with @getMapping.

  1. conclusion

As mentioned in the beginning, Spring Boot is very simple and easy to use. As long as you have mastered the basic Java syntax, and have certain network knowledge and database knowledge, you can easily start using it. The emergence of Spring Boot greatly improves the development efficiency of the project, but also reduces the threshold of entry. But just because it’s easy to get started doesn’t mean it doesn’t have depth and difficulty. On the contrary, Spring Boot has a great deal of depth, from Spring Boot to Java, from Java to JVM, from JVM to operating system, as well as various databases, network protocols, message queues, other middleware… Spring Boot has a wealth of ecological content for every project, from small to large. There is a wonderful world waiting for you to explore, and today’s content is just a preparation for the journey.