springboot部分常用注解
目录:【持续更新。。。。。】
spring 部分常用注解
spring boot 学习之路1(简单入门)
spring boot 学习之路2(注解介绍)
spring boot 学习之路3( 集成mybatis )
spring boot 学习之路4(日志输出)
spring boot 学习之路5(打成war包部署tomcat)
spring boot 学习之路6(定时任务)
spring boot 学习之路6(集成durid连接池)
spring boot 学习之路7(静态页面自动生效问题)
spring boot 学习之路8 (整合websocket(1))
spring boot 学习之路9 (项目启动后就执行特定方法)
1. @RestController 和@Controller
@Controller
public class AnnotController {
@ResponseBody
@RequestMapping("/hello")
public String hello() {
return "Hello huhy";
}
}

@RestController
public class AnnotController{
@RequestMapping("/hello")
public String hello() {
return "Hello huhy";
}
}
@RestController
@RequestMapping("demoAnnot")
public class testController {
@RequestMapping(value = "/hello/{name}/{age}", method = RequestMethod.GET)
public String hello(@PathVariable("name") String name,@PathVariable("age") int myAge) {
return "我是" + name +"年龄 " + myAge;
}
}
@RestController
@RequestMapping("demoAnno")
public class testController {
@RequestMapping(value = "/hello", method = RequestMethod.GET)
public String hello(@RequestParam(value = "name", required = false, defaultValue = "null") String name) {
return "我是" + name ;
}
}
@RestController
@RequestMapping("demoAnno")
public class testController {
@RequestMapping(value = "/hello", method = RequestMethod.POST)
public String hello(@RequestBody RequestOrderVo requestOrderVo) {
return "我是" + requestOrderVo.getName +"年龄 "+requestOrderVo.getAge;
}
}
springboot部分常用注解的更多相关文章
- SpringBoot 中常用注解
本篇博文将介绍几种SpringBoot 中常用注解 其中,各注解的作用为: @PathVaribale 获取url中的数据 @RequestParam 获取请求参数的值 @GetMapping 组合注 ...
- SpringBoot 中常用注解@PathVaribale/@RequestParam/@GetMapping介绍
SpringBoot 中常用注解@PathVaribale/@RequestParam/@GetMapping介绍 本篇博文将介绍几种如何处理url中的参数的注解@PathVaribale/@Requ ...
- SpringBoot 中常用注解@Controller/@RestController/@RequestMapping的区别
SpringBoot中常用注解@Controller/@RestController/@RequestMapping的区别 @Controller 处理http请求 @Controller //@Re ...
- SpringBoot 中常用注解@Controller/@RestController/@RequestMapping介绍
原文 SpringBoot 中常用注解 @Controller/@RestController/@RequestMapping介绍 @Controller 处理http请求 @Controller / ...
- SpringBoot+Spring常用注解总结
为什么要写这篇文章? 最近看到网上有一篇关于 SpringBoot 常用注解的文章被转载的比较多,我看了文章内容之后属实觉得质量有点低,并且有点会误导没有太多实际使用经验的人(这些人又占据了大多数). ...
- SpringBoot中常用注解@Controller/@RestController/@RequestMapping的区别
@Controller 处理http请求 @Controller //@ResponseBody public class HelloController { @RequestMapping(valu ...
- springboot系列总结(二)---springboot的常用注解
上一篇文章我们简单讲了一下@SpringBootApplication这个注解,申明让spring boot自动给程序进行必要的配置,他是一个组合注解,包含了@ComponentScan.@Confi ...
- SpringBoot之常用注解
在spring boot中,摒弃了spring以往项目中大量繁琐的配置,遵循约定大于配置的原则,通过自身默认配置,极大的降低了项目搭建的复杂度.同样在spring boot中,大量注解的使用,使得代码 ...
- 【SpringBoot】常用注解
@EnableAutoConfiguration 启动自动装载:使用了这个注解之后,所有引入的jar的starters都会被自动注入.这个类的设计就是为starter工作的. @RestControl ...
随机推荐
- 【ABP框架系列学习】模块系统(4)之插件示例开发
0.引言 上一篇博文主要介绍了ABP模块及插件的相关知识,本章节主要开发一个插件示例来学习如何创建一个插件,并在应用程序中使用.这个命名为FirstABPPlugin的插件主要在指定的时间段内删除审计 ...
- vue 项目实战 (入门)
环境搭建 安装NodeJS →箭头https://nodejs.org/en/ NPM是随同NodeJS一起安装的包管理工具. 检查环境是否安装成功: 打开一个命令提示符,有成功输出版本号则为安装成功 ...
- 剑指offer例题分享--4
前言:搁置许久的更新要继续开始了!前一段时间一直在忙项目和C++的学习,所以搁置了!要改变注意了,要用C++进行编写了,因为要不断练习C++! 面试题15: 书中要求只能遍历链表一次,所以代码如下: ...
- linux 命令 — sort、uniq
sort uniq sort:对行或者文本文件排序 uniq:去除重复的行 常用 sort -n file.txt 按数字进行排序 sort -r file.txt 按逆序进行排序 sort -M f ...
- mysql年初至今聚合
年初至今聚合和滑动聚合类似,不同的地方仅在于统计的仅为当前一年的聚合.唯一的区别体现在下限的开始位置上.在年初至今的问题中,下限为该年的第一天,而滑动聚合的下限为N个月的第一天.因此,年初至今的问题的 ...
- python三大神器之pip
pip是一款管理python各类包和库的工具,非常好用.下文介绍常用的一些命令. ● 安装:pip install 库名 也可以指定版本:pip install 库名=版本 ● 卸载:pip unin ...
- Java设计模式学习记录-观察者模式
前言 观察者模式也是对象行为模式的一种,又叫做发表-订阅(Publish/Subscribe)模式.模型-视图(Model/View)模式. 咱们目前用的最多的就是各种MQ(Message Queue ...
- 聊聊数据库~2.SQL环境篇
传统数据库 上篇文章:聊聊数据库~开篇 https://www.cnblogs.com/dotnetcrazy/p/9690466.html 本来准备直接开讲NoSQL的(当时开篇就是说的NoSQL) ...
- Runtime详解(下)
Runtime应用 1.Runtime 交换方法 应用场景:当第三方框架或者系统原生方法功能不能满足我们的时候,我们可以在保持系统原有功能的基础上,添加额外的功能. 需求:加载一张图片直接用系统的[U ...
- 怎么使用小程序的data-*属性?
参考文档:小程序事件 怎么使用小程序的data-*属性?[data-type,data-num,……] dataset 在组件中可以定义数据,这些数据将会通过事件传递给 SERVICE. 书写方式: ...