SpringBoot learning (1) Idea creates SpringBoot project

The creation process is as follows:

Configure project name and java environment

Package dependency injection

To this end, please wait for idea to download the relevant jar packages from the server (the process is slow)

File structure description

It is worth mentioning that the application file is configured like a database connection, personal preference to use .yml format. (The configuration syntax is more concise)

pom.xml is dependent on the configuration package, if the option of auto import appears (you can automatically change the dependent and download the relevant jar package)

Say Hello world to Springboot

@Controller//告诉Spring这是一个controller
public class MyController {

    @ResponseBody
    @RequestMapping("/hello")//服务器地址
    public String hello(){
        return "Hello World";
    }
}

After writing the above classes, make sure that the main startup class exists.

Click to start Springboot service

Send a request on the client (browser)

See the response from the server to Hello World

 

Published 25 original articles · Likes6 · Visits 10,000+

Guess you like

Origin blog.csdn.net/qq_37446649/article/details/89398977