要在Eclipse里使用SpringBoot,首先要安装下STS插件
注意:STS插件运行必须是JDK1.8 否则会出现安装失败的情况;
创建SpringBoot项目创建SpringBoot项目pom.xml文件第一行报错:Non-parseable POM
或者run as 没有Spring Boot App-->解决方法
参考-->配置STS插件两种方法
插件安装完毕,然后我们来新建一个SpringBoot项目
新建 选择 Spring Boot->Spring Starter Project
点击“Next”,显示
到了配置依赖的界面,暂时不需要用到其他的,仅选择一个Web依赖即可
然后点击Finish完成。
HelloWorldApplication是启动类,我们右击Run As 选择 Spring Boot app
我们浏览器输入:http://localhost:8080/
出现这个 说明项目启动成功;
我们现在配置一个HelloWorld请求
在com.exmple.demo包下,新建一个HelloWorldController类
package com.example.demo;
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";