使用注解的优势:

1.采用纯java代码,不在需要配置繁杂的xml文件

2.在配置中也可享受面向对象带来的好处

3.减少复杂配置文件的同时亦能享受到springIoC容器提供的功能

  @SpringBootApplication:申明让spring boot自动给程序进行必要的配置,这个配置等同于:@Configuration ,@EnableAutoConfiguration 和 @ComponentScan 三个配置。

  @Bean:用@Bean标注方法等价于XML中配置的bean。相当于XML中的,放在方法的上面,而不是类,意思是产生一个bean,并交给spring管理。

  @RequestMapping   和  @GetMapping @PostMapping 区别:

  @GetMapping是一个组合注解,是@RequestMapping(method = RequestMethod.GET)的缩写。

  @PostMapping是一个组合注解,是@RequestMapping(method = RequestMethod.POST)的缩写。

  @AutoWired是byType的,类型都相同时,就需要使用@Qualifier明确指定使用那个具体的实现。因此,@Qualifier是byName的。

SpringBoot注解集合的更多相关文章

  1. spring-boot 注解集合

    @Configuration 用于定义配置类,可替换XML配置文件,被注解的类内部包含一个或多个@Bean注解方法.可以被AnnotationConfigApplicationContext或者Ann ...

  2. SpringBoot注解验证参数

    SpringBoot注解验证参数 废话不多说,直接上表格说明: 注解 作用类型 解释 @NotNull 任何类型 属性不能为null @NotEmpty 集合 集合不能为null,且size大于0 @ ...

  3. springboot注解使用说明

    springboot注解 @RestController和@RequestMapping注解 我们的Example类上使用的第一个注解是 @RestController .这被称为一个构造型(ster ...

  4. springBoot系列-->springBoot注解大全

    一.注解(annotations)列表 @SpringBootApplication:包含了@ComponentScan.@Configuration和@EnableAutoConfiguration ...

  5. SpringBoot注解大全(转)

    原文链接:[springBoot系列]--springBoot注解大全 一.注解(annotations)列表 @SpringBootApplication:包含了@ComponentScan.@Co ...

  6. springboot注解大全

    springboot注解:@Service: 注解在类上,表示这是一个业务层bean@Controller:注解在类上,表示这是一个控制层bean@Repository: 注解在类上,表示这是一个数据 ...

  7. SpringBoot注解把配置文件自动映射到属性和实体类实战

    SpringBoot注解把配置文件自动映射到属性和实体类实战 简介:讲解使用@value注解配置文件自动映射到属性和实体类 1.配置文件加载 方式一 1.Controller上面配置 @Propert ...

  8. 转-spring-boot 注解配置mybatis+druid(新手上路)-http://blog.csdn.net/sinat_36203615/article/details/53759935

    spring-boot 注解配置mybatis+druid(新手上路) 转载 2016年12月20日 10:17:17 标签: sprinb-boot / mybatis / druid 10475 ...

  9. 【转载】springboot注解

    https://blog.csdn.net/yitian_66/article/details/80866571 springboot注解:@Service: 注解在类上,表示这是一个业务层bean@ ...

随机推荐

  1. inceptor es表插入成功,返回报错you should set transaction.type before any DCL statement

    在finebi下用星环的连接驱动去写inceptor es表,发现插入能成功,但是返回一个报错: Caused by: java.sql.SQLException: Error to commit. ...

  2. The Preliminary Contest for ICPC Asia Shenyang 2019 D. Fish eating fruit(树形dp)

    题意:求一棵树上所有路径和模3分别为0 1 2 的权值的和 思路:树形dp 增加一个记录儿子节点满足条件的个数的数组 不要放在一起dp不然答案跟新会有问题 #include <bits/stdc ...

  3. Grakn Forces 2020

    比赛链接:https://codeforces.com/contest/1408 A. Circle Coloring 题意 给出三个长为 $n$ 的序列 $a,b,c$,对于每个 $i$,$a_i ...

  4. Triangle War POJ - 1085 极小极大搜索

    参考链接:https://www.cnblogs.com/nwpuacmteams/articles/5697873.html 极小极大搜索 的个人理解(alpha-beta剪枝):https://w ...

  5. hdu2639 Bone Collector II

    Problem Description The title of this problem is familiar,isn't it?yeah,if you had took part in the ...

  6. 说说Golang goroutine并发那些事儿

    摘要:今天我们一起盘点一下Golang并发那些事儿. Golang.Golang.Golang 真的够浪,今天我们一起盘点一下Golang并发那些事儿,准确来说是goroutine,关于多线程并发,咱 ...

  7. Redis 数据迁移 & 数据审计

    Redis 数据迁移 安装迁移工具 # 安装依赖 [root@dbtest03 ~]# yum install -y automake libtool autoconf bzip2 git # 拉取工 ...

  8. docker的企业级仓库-harbor

    Harbor 一.背景 Docker中要使用镜像,我们一般都会从本地.Docker Hub公共仓库或者其它第三方的公共仓库中下载镜像,但是出于安全和一些内外网的原因考虑,企业级上不会轻易使用.普通的D ...

  9. Gym 101464C - 计算几何+二分(uva1463)

    不是很难,但是我觉得对代码能力的要求还是挺高的. 注意模块化. 因为是浮点数,所以二分用的很多很多. 参考 https://blog.csdn.net/njupt_lyy/article/detail ...

  10. C++中的explicit

    首先, C++中的explicit关键字只能用于修饰只有一个参数的类构造函数, 它的作用是表明该构造函数是显示的, 而非隐式的, 跟它相对应的另一个关键字是implicit, 意思是隐藏的,类构造函数 ...