我的第一个SpringBoot应用
来源:互联网 发布:红叶知弦调教 编辑:程序博客网 时间:2024/05/18 13:04
Controller的使用
@RestControllerpublic class HelloController { //http://localhost:8081/demo/hello/100 @RequestMapping(value = "/hello" ,method = RequestMethod.GET) private String sayHello(){ return "Hello String Boot"; } //http://localhost:8081/demo/hello/100 @RequestMapping(value = "/hello1/{id}" ,method = RequestMethod.GET) private String sayHello1(@PathVariable("id") Integer id){ return "id"+id; } //http://localhost:8081/demo/hello?id=100 @RequestMapping(value = "/hello2" ,method = RequestMethod.GET) private String sayHello2(@RequestParam("id") Integer id){ return "id"+id; }}
SpringBoot配置文件
在resources下的application.properties#端口号server.port=8081#rootserver.context-path=/demo
访问http://localhost:8081/demo/hello就能够访问成功了
阅读全文
0 0
- 我的第一个SpringBoot应用
- 第一个springboot应用
- SpringBoot学习(一) — 我的第一个SpringBoot工程
- springboot第一个应用hello
- 我的第一个SpringBoot项目 Component Autowired
- 我的第一个SpringBoot 项目——Hello World
- 我的第一个ionic应用的
- 我的第一个WM上架应用
- 我的第一个android应用,BlankLocker
- 我的第一个android应用 --《段子》
- 我的第一个 Symbian Qt 应用
- 我的第一个Symbian Qt应用
- 我的第一个ant应用
- 我的第一个应用宣告失败.
- 我的第一个应用(一)
- 我的第一个应用(二)
- 我的第一个应用(三)
- 我的第一个Android应用
- 死锁
- java for的几种循环方式
- C#DES文件加解密工具类
- [模板]treap小结
- String StringBuffer 和StringBuild之间的区别
- 我的第一个SpringBoot应用
- Angular 元数据
- 设计模式——单件模式(Singleton Pattern)
- Java中String、StringBuffer、StringBuilder的区别
- Spark ML随机森林
- Github使用教程------ Github客户端使用方法
- Left Right Action Support
- 使用线程池与内部类实现方法异步
- Spark Sql 编程式结构DataType转换 代码类小结