林木森|极致源于热爱

vuePress-theme-reco linmsen    2017 - 2020
林木森|极致源于热爱 林木森|极致源于热爱

Choose mode

  • dark
  • auto
  • light
首页
分类
  • 算法
  • 框架
  • 面试
标签
时间轴
文档
  • 架构
  • 软实力
  • 云原生
  • 中间件
  • JAVA
  • 学习资源
  • 导航
摄影
联系方式
  • GitHub
  • CSDN
  • 博客园
  • 个人博客
author-avatar

linmsen

10

Article

3

Tag

首页
分类
  • 算法
  • 框架
  • 面试
标签
时间轴
文档
  • 架构
  • 软实力
  • 云原生
  • 中间件
  • JAVA
  • 学习资源
  • 导航
摄影
联系方式
  • GitHub
  • CSDN
  • 博客园
  • 个人博客

spring

vuePress-theme-reco linmsen    2017 - 2020

spring


linmsen 2020-08-01 spring

# spring注解

# 注入

https://zhuanlan.zhihu.com/p/44179797

@Value   注入int、float、String等基本数据类型,只能标注在成员变量、setter方法上。
@Autowired    按类型自动装配,可标注在成员变量(官方不推荐)、构造方法、setter方法上。
@Qualifier   按名称自动装配,需要和@Autowired搭配使用,只能标注在成员变量(官方不推荐)、setter方法上。

@Resource    按名称或类型自动装配,需要第三方包 javax.annotation.jar 的支持,只能标注在成员变量、setter方法上。
1
2
3
4
5

# 模式注解

@Repository
@Component
@Controller
@Configuration
全部是@Component的派生注解
1
2
3
4
5

装配类

@ImportResource
@Import
@ComponmentScan
1
2
3

# 循环依赖

@Lazy
1

# 构造器

如果构造器需要用到注入的参数字段,需要加

@PostConstruct
1

# 元注解

@Target 注解用在哪里
@Retention
@Documented
@Inherited
@Repeatable
1
2
3
4
5

# 派生性

注解描述注解

# @Enable模块驱动

# @Configuration驱动

# 条件注解

@C

  • spring注解
  • 注入
  • 模式注解
  • 循环依赖
  • 构造器
  • 元注解
  • 派生性
  • @Enable模块驱动
  • @Configuration驱动
  • 条件注解
我是lookroot欢迎你的关注
看板娘