码迷,mamicode.com
首页 > 编程语言 > 详细

Spring-boot入门

时间:2019-10-11 09:19:23      阅读:90      评论:0      收藏:0      [点我收藏+]

标签:tar   file   line   inf   body   技术   header   sbo   art   

你好,万能的Spring boot,开始入坑

1、新建Spring boot工程,两种方式

  • spring官网生成代码(SPRING INITIALIZR)http://start.spring.io/
  • 在IDE里STS,File > New > Project > Spring Starter Project

2、新建Controller类,试水REST风格编程

1
2
3
4
5
6
7
8
9
@RestController
@RequestMapping("hello")
public class HelloController {

@RequestMapping("info")
public String hello(@RequestParam String name){
return "你好:"+name;
}
}

3、启动工程,访问 http://localhost:8088/hello/info?name=yangyubin

4、修改tomcat端口号

1
2
3
4
/sboot-demo/src/main/resources/application.yml

server:
port: 8088

附工程结构图

技术图片

原文:大专栏  Spring-boot入门


Spring-boot入门

标签:tar   file   line   inf   body   技术   header   sbo   art   

原文地址:https://www.cnblogs.com/sanxiandoupi/p/11651543.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!