【SpringBoot】入门笔记01_SpringBoot安装、Gradle安装、Gradle编译项目并导入eclipse、初试SpringBoot的Controller

SpringBoot + Gradle + thymeleaf + h2快速入门

    SpringBoot +  项目管理工具 + 代替jsp + 内存数据库
1)安装SpringBoot
    https://spring.io/tools/sts/all
2)安装Gradle
    https://services.gradle.org/distributions/
    新建环境变量GRADLE_HOME    ,配置为你安装GRADLE的目录
    修改环境变量Path,在后面+上 %GRADLE_HOME%\bin

【SpringBoot】入门笔记01_SpringBoot安装、Gradle安装、Gradle编译项目并导入eclipse、初试SpringBoot的Controller_第1张图片

cmd->gradle -v 出现以上画面代表配置成功。
3)使用Gradle编译项目
    创建:https://start.spring.io/

【SpringBoot】入门笔记01_SpringBoot安装、Gradle安装、Gradle编译项目并导入eclipse、初试SpringBoot的Controller_第2张图片


    来到解压的目录
        gradle build

【SpringBoot】入门笔记01_SpringBoot安装、Gradle安装、Gradle编译项目并导入eclipse、初试SpringBoot的Controller_第3张图片


4)将编译好的项目导入到eclipse中(import project->exiting Gradle project->到build好的项目)--初次使用需要等待较长时间

【SpringBoot】入门笔记01_SpringBoot安装、Gradle安装、Gradle编译项目并导入eclipse、初试SpringBoot的Controller_第4张图片

成功导入:

【SpringBoot】入门笔记01_SpringBoot安装、Gradle安装、Gradle编译项目并导入eclipse、初试SpringBoot的Controller_第5张图片

启动SpringBoot应用 run as -> java application

查看localhost:8080   看到以下画面

【SpringBoot】入门笔记01_SpringBoot安装、Gradle安装、Gradle编译项目并导入eclipse、初试SpringBoot的Controller_第6张图片

开发Controller

@RestController
public class firstController {
	@RequestMapping("/hello.do")
	public String test() {
		return "HelloSpringBoot";
	}
}

成功页面:

【SpringBoot】入门笔记01_SpringBoot安装、Gradle安装、Gradle编译项目并导入eclipse、初试SpringBoot的Controller_第7张图片

 

你可能感兴趣的:(SpringBoot)