标签:笔记 ref font ack com tom 技术 span round
新建Srping Boot 项目
以下是项目结构
由于Srping Boot内置Tomcat,所以不需要配置Tomcat就可以直接运行。
HelloWorldApplication是启动类,我们右击Run As 选择 Spring Boot app。
项目运行好之后
在浏览器输入:http://localhost:8080/
看到这个页面项目就算启动好了。
然后新建一个HelloWorldController类
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloWorldController {
@RequestMapping("/helloWorld")
public String say() {
return "HelloWorld";
}
}
然后我们重新启动HelloWorldApplication类
请求 http://localhost:8080/helloworld
标签:笔记 ref font ack com tom 技术 span round
原文地址:http://www.cnblogs.com/fyys/p/7625931.html