# demo-spring-boot-git **Repository Path**: hikseason/demo-spring-boot-git ## Basic Information - **Project Name**: demo-spring-boot-git - **Description**: ## 1.SpringBoot新建测试 ## 2.SpringBoot上传到git - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2018-06-17 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 海客森 # 1.SpringBoot新建(season) 1. 码云: 2. 视频地址: ## 1.新建工程 1. 选择SpringBoot框架:Spring Initializr 2. 配置组名(也称为域名):com.viphome。项目名称demo-spring-boot-git 3. 选择依赖,web,lombok,下一步 4. 删除mvn的相关文件夹 5. 查看pom和主程序以及文档结构 ![项目](https://gitee.com/hikseason/demo-spring-boot-git/raw/master/aDoc/images/test.png) ## 2.新建Controller 1. @Controller只是SpringIOC的一种注解方式,表示通过Spring容器来New也就是初始化类 2. 写方法hello() ``` public String hello() { return "Hello World"; } ``` 3. 构建路由@RequestMapping("/hello") 4. 返回为json而不是页面,@ResponseBody ## 3.启动主程序 1. DemoSpringBootGitApplication 2. 注意程序的Main方法为整个项目的入口方法,其中主项目加了注解 3. @SpringBootApplication,继承了Component的 # 2.项目测试 1. 浏览器测试 2. postman等工具测试,我这里采用RestClient 3. Chrom右上角==>更多工具==>扩展程序==>拖拽extension_2_8_0_1.crx ## 1.路由测试 1. @RequestMapping可以改为@PostMpping 2. Get,大小<=2m ## 2.@ResponseBody 1. 去掉该注解,访问的是视图处理后的页面 2. 访问HelloWorld.html这个页面,但是有点问题 ## 3.加入视图处理thymeleaf 1. 前端模板引擎:我们采用thymeleaf 2. 引入jar:spring-boot-starter-thymeleaf 3. thymeleaf、FreeMarker、Velocity # 3.上传到git 1. 首先要有git,并新建了项目,demo-spring-boot-git ## 1. 桌面新建文件夹test 1. cd到test文件夹,然后右键,Git Bash Here ```aidl git clone url地址 ``` 2. 输入密码 ## 2.进入项目重新打开Git Bash Here 1. 或者上个目录cd进到该项目中 2. 进入原项目地址,idea中,右键文件夹位置Directory Path ## 3.执行maven命令 ```aidl git add .(有点) 注意在此之前已经生成ignore,否则上传过一次比如target就删不掉了 git commit -m '第一次上传' git push ``` 1. 直接在idea打开git ## 4.备注 1. 在该文件夹中:可以查看git的配置,git config --list