博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
第 2 章 Spring Boot
阅读量:7296 次
发布时间:2019-06-30

本文共 1478 字,大约阅读时间需要 4 分钟。

注意以下使用 Spring boot 1.5.2

2.1. Spring Boot Quick start

2.1.1. pom.xml

4.0.0
api.netkiller.cn
api.netkiller.cn
0.0.1-SNAPSHOT
Skyline
skylinechencf@gmail.com
org.springframework.boot
spring-boot-starter-parent
1.4.0.RELEASE
org.springframework.boot
spring-boot-starter-web
src
maven-compiler-plugin
3.3

2.1.2. Controller

package hello;import org.springframework.boot.*;import org.springframework.boot.autoconfigure.*;import org.springframework.stereotype.*;import org.springframework.web.bind.annotation.*;@Controller@EnableAutoConfigurationpublic class SampleController {    @RequestMapping("/")    @ResponseBody    String home() {        return "Hello World!";    }    public static void main(String[] args) throws Exception {        SpringApplication.run(SampleController.class, args);    }}

测试

curl http://127.0.0.1:8080/

原文出处:Netkiller 系列 手札

本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。

你可能感兴趣的文章
SQLServer异步调用,批量复制
查看>>
复习装饰器
查看>>
倍增算法
查看>>
Vim statusline设置
查看>>
蒙特卡罗算法并行计算
查看>>
Linq To Sql数据库操作基类实现不同条件的增删改查
查看>>
IDEA使用
查看>>
Length of Last Word
查看>>
Python与机器人技术
查看>>
Android 屏幕兼容性
查看>>
JDK 新特性
查看>>
正则表达式_matches(Regex)
查看>>
log代替system.out.println输出
查看>>
对象和数组的遍历方法
查看>>
Jmeter之root ca certificate 问题
查看>>
使用for--each遍历集合
查看>>
MySQL双主+keeplived安装部署说明
查看>>
基于HWND的Win32 UI自动化
查看>>
WebService 入门程序(一)
查看>>
深入计算机系统 练习题2.44 补码运算
查看>>