mac、windows eclipse 新建(导入)并运行Springboot2.x项目

1.需要先安装eclipse springboot插件,mac上面是一个单独软件STS

https://www.cnblogs.com/xiaqiuchu/articles/14319410.html

2.使用aliyun的在线生成代码初始化springboot项目

https://start.aliyun.com/

 

安装组件:https://blog.csdn.net/liang841451955/article/details/96997993

选择需要引入的包,引入如下几个包即可满足web开发:DevTools(代码修改热更新,无需重启)、Web(集成tomcat、SpringMVC)、Lombok(智能生成setter、getter、toString等接口,无需手动生成,代码更简介)、Thymeleaf (模板引擎)。

 

3.选择完毕组件后下载代码,通过mac STS(windows上面是直接在ecliose里面导入的) 导入项目

https://blog.csdn.net/qq_38555490/article/details/90263684

 

4.启动项目

 

 

 

5.现在还没有编写业务/逻辑代码,先写一个测试路由, 

模板不存在报错:https://blog.csdn.net/qq_41063141/article/details/93459068

第一个页面:https://blog.csdn.net/u012561176/article/details/91045487

springboot返回模板/json:https://blog.csdn.net/zt_fucker/article/details/59508380

package com.example.demo;
// Controller注解是返回名为hello的htm模板,如果模板不存在则会报错模板不存在
//import org.springframework.web.bind.annotation.Controller;
// RestController 注解返回string字符串(也就是等同于可以返回json)
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;


//@Controller
@RestController
public class SoupDataSource {

    @RequestMapping("/hehe")
    public String gg(){
        return "hello";
    }


}

 

posted @ 2021-01-24 14:47  夏秋初  阅读(477)  评论(0编辑  收藏  举报