1.创建一个简单的maven project项目

2.项目目录结构

**注意启动类的位置:

3.pom.xml 配置jar包

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version>
<relativePath/>
</parent> <dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>

4、创建一个SpringBoot项目运行的启动类

package com.lxp.Application;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication
public class StartApplication {
public static void main(String[] args) {
SpringApplication.run(StartApplication.class, args);
}
}

5、创建一个controller(@Controller只返回页面;@RestController返回json格式的数据)

package com.lxp.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; @RestController
public class HelloWordController { @RequestMapping("hello")
public String hello() { return "HelloWord";
} }

6.查看效果

最新文章

  1. Android 如何有效的解决内存泄漏的问题
  2. sql语句查询经纬度范围(转载,源链接失效)
  3. Python for Informatics 第11章 正则表达式五(译)
  4. mvc局部视图
  5. URAL - 1920 Titan Ruins: the Infinite Power of Magic(乱搞)
  6. 如何在mac上安装gradle
  7. 笔记13:File 类的一些操作
  8. html 元素 变小手
  9. 关于学习Scala语言的一些感悟
  10. Discount Diesel Time 9150-1 Quartz Wrist watch [WAT022]- US$4.49
  11. bzoj2120: 数颜色 [莫队][分块]
  12. HTML文本
  13. pip安装selenium报错:Read timed out
  14. HALCON学习笔记
  15. dubbo源码之服务消费
  16. Spring Boot 揭秘与实战(五) 服务器篇 - 内嵌的服务器 Tomcat剖析
  17. flask中路由的本质源码分析
  18. GADL针对矢量数据格式转换的实用工具 —— ogr2ogr
  19. feign中的hytrix和turbin配置
  20. hadoop HA sshfen切换隔离时无法跳转ssh: bash: fuser: 未找到命令

热门文章

  1. Scrapy爬虫基本使用
  2. python中的数学类型及操作
  3. Swagger与OAuth 手动搭建WebApi 操作笔记
  4. Dictionary-Guided Editing Networks for Paraphrase Generation解读
  5. EVE无法安装vim
  6. Httpclient 工具类(get,put)
  7. 前端——语言——Core JS——《The good part》读书笔记——第五章节(Inheritance)
  8. 远程传输文件命令:scp
  9. py2
  10. GO学习之 从hello.go开始