0
点赞
收藏
分享

微信扫一扫

零基础学习SpringBoot2-写一个HelloWorld

简介

Spring Boot来简化Spring应用开发,约定大于配置, 去繁从简。

创建SpringBoot项目

零基础学习SpringBoot2-写一个HelloWorld_spring

添加依赖

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

写一个最简单的控制器

package com.lglbc.springbootlearning;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class IndexController {
@RequestMapping("/test")
public String hello(){
return "helloWorld";
}
}

运行项目

零基础学习SpringBoot2-写一个HelloWorld_spring_02

测试一波

​​http://localhost:8080/test​​零基础学习SpringBoot2-写一个HelloWorld_应用开发_03


举报

相关推荐

0 条评论