On Spring Boot

What is Spring Boot

Wikipedia says this:

Spring Boot is a new framework provided by the Pivotal team, designed to simplify the initial setup and development of new Spring applications . The framework uses a specific way to configure, so that developers no longer need to define boilerplate configuration. In this way, Spring Boot aims to be a leader in the booming field of rapid application development.

Spring Boot is a spring application service framework. Using Spring Boot allows us to quickly create a Spring-based project, and to make this Spring project run, we only need very little configuration.

Spring Boot Features

Spring Boot provides a powerful one-click Spring integrated development environment that can independently develop a Spring application, including: 

1. Standalone Spring project

    Spring Boot can be run in the form of a jar package. To run a Spring Boot project, we only need to run it through the Java-jar xx.jar class. Very convenient.

2. Embedded Tomcat and Jetty containers can be directly typed into jar packages to start, no need to provide Java war packages and cumbersome web configuration 

3. Provide starter to simplify Maven configuration

4. Automatically configure Spring 

5. Quasi-production application monitoring . Such as system monitoring, health diagnosis, permission control

6. No redundant code generation and xml configuration

7. Support restfult style coding, very concise

 

+--------------------------------------------------------+

Here is a Spring Boot content note, click here to enter

+--------------------------------------------------------+

project creation

Taking IntelliJ IDEA as an example, first create a project, select Spring Initializr when creating, and then Next, as shown below:

Fill in the project information, as shown below:

Fill in the technology used in the project. It is recommended to select the latest stable version for the Spring Boot version above. Just check the Web below:

The last step, fill in the project name and click finish:

OK, the system will download the required dependencies when it is created for the first time, which takes a little longer, and will be created quickly every time in the future

OK, after the project is created successfully, let's take a look at how this thing works. First of all, we see that after the project is successfully created, there will be an entry class for the artifactId+Application naming rule in the root directory of the project, as shown below: 

This TestSpringbootApplication class is the entry class of the entire project. This class has a @SpringBootApplication annotation, which is the core annotation of the entire Spring Boot. Its purpose is to enable the automatic configuration of Spring Boot. OK, then I add another @RestController annotation to this class to make it a Controller, and then provide an address conversion method, as follows:

@RestController
@SpringBootApplication
public class TestSpringbootApplication {

   public static void main(String[] args) {
      SpringApplication.run(TestSpringbootApplication.class, args);
   }

   @RequestMapping(value = "/",produces = "text/plain;charset=UTF-8")
   String index(){
      return "Hello Spring Boot!";
   }
}

Then click the project startup button to run, which is the button in IntelliJ: or right-click on the class or class name to see the startup method

No problem after startup

After that, we can access it directly in the browser, as follows:

OK, so far, we have created a simple Spring Boot project and successfully accessed it from the browser

 

 

Reference link

 

Getting to know the Spring Boot framework

Spring Boot (top)

Starter for Spring Boot

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324943770&siteId=291194637