Creation and startup of SpringBoot project


Spring Boot

1. Concept

Spring was born to simplify Java program development, and SpringBoot was born to simplify Spring program development. That is to say, SpringBoot was born to quickly build Spring projects.

Advantages of Spring Boot :

  • Quickly integrate the framework, SpringBoot provides the function of starting and adding dependencies, which can be used to integrate various frameworks in seconds
  • Built-in running container, no need to configure web containers such as Tomcat, and can directly run and deploy Java programs
  • Ability to quickly deploy projects and get projects up and running without external containers
  • You can completely abandon the cumbersome XML and use annotations and configurations for development
  • Support more monitoring indicators to better understand the operation of the project

2. Creation of SpringBoot project

insert image description here

insert image description here
Add external jar package

insert image description here

insert image description here

insert image description here

insert image description here

3. SpringBoot web version creation

Web version connection

insert image description here

After downloading the zip file and decompressing it, open it through idea

insert image description here

4. Start Spring Boot

The Spring Boot project has a core design idea: the convention is greater than the configuration.
All classes that need to be scanned and loaded by Spring Boot must be placed in the same directory as the Spring Boot startup class, then SpringBoot will automatically scan and load the corresponding Class
Spring Boot does not need to configure the scanning path of beans like Spring

insert image description here

@Controller
public class DemoController {
    
    

    @RequestMapping("/hello") // 路由
    @ResponseBody // 返回给浏览器一个接口而非页面
    public String getInfo(String str) {
    
    
        return "hello spring boot "+str;
    }
}

After running SpringBoot, the browser accesses port 8080

insert image description here

insert image description here


Guess you like

Origin blog.csdn.net/weixin_53946852/article/details/129695849