首先创建个一个springboot的项目
选择Spring Initializer,点击下一步

创建项目名称,点击下一步

我们要创建web项目,所以在这一步我们选中web项,点击下一步,设置项目文件存储的位置,我们的项目就算是创建完成了

项目创建好了之后,我们先来看看项目的结构


如果这都处理好了的话,那就是新建一个包

package com.example.demo.com;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class hello {
@RequestMapping("/")
String home() {
return "Hello World!";
}
}
然后运行,然后浏览器输入http://127.0.0.1:8080/即可了
网友评论