当前位置:网站首页>注解开发相关
注解开发相关
2022-07-30 07:37:00 【晓白夏】
启动注解
启动注解扫描,加载类中配置的注解项
<context:component-scan base-package="packageName"/>
bean的定义
@Component @[email protected]@[email protected]
作用:设置该类为spring管理的bean
bean的作用域
@Scope
设置该类作为bean对应的scope属性
bean的生命周期
@PostConstruct @PreDestroy
设置该类作为bean对应的生命周期方法
加载第三方资源
@Bean
设置该方法的返回值作为spring管理的bean
bean的非引用类型属性注入
@Value
设置对应属性的值或对方法进行传参
bean的引用类型属性注入
设置对应属性的对象或对方法进行引用类型传参
bean的引用类型属性注入
@Primary
设置类对应的bean按类型装配时优先装配
bean的引用类型属性注入
@Inject @Named @Resource
加载properties文件
@PropertySource
@PropertySource(value="classpath:xxx.properties")
public class Xxx{
@Value("${propertiesAttributeName}")
private String attributeName;
}
边栏推荐
- RT-Thread-GD32的SPI在切换同一总线不同挂载设备时会出现切换后乱发送数据的问题
- redis常用指令
- Handler消息机制-Native层
- 【无标题】
- ipset restore命令维护set,但原已存在的条目未删除掉
- SQL注入漏洞(postgresql注入)
- 基于JSP实现校园二手交易平台
- 潜心打磨,主动求变——这群技术排头兵,如何做好底层开发这件事?
- 香港服务器iis配置web服务器如何操作?
- Interview with Ant: How do these technology pioneers do the bottom-level development well?| Excellent technical team interview
猜你喜欢
OA项目之待开会议&历史会议&所有会议
立创EDA——PCB的走线(五)
Leetcode 2.两数相加 两个非空的链表,表示两个非负的整数。它们每位数字都是按照逆序的方式存储的。
typescript4 - installs a toolkit for compiling ts
typescript2-typescript为什么给js添加类型支持
OA Project Pending Meeting & History Meeting & All Meetings
2022牛客暑期多校训练营3(ACFGJ)
The blockbuster IP that has been popular in the world for 25 years, the new work has become a script paradise
linux安装mysql8参考指引
Delphi仿制Web的导航
随机推荐
SQL row-column conversion
潜心打磨,主动求变——这群技术排头兵,如何做好底层开发这件事?
2022年施工企业数字化转型思考,施工企业数字化转型之路
谷粒商城--环境部署(2022/7/28最新)
stack containing min function (js)
SQL行列转换
Lenovo Notebook How to Change Windows 10 Boot Logo Icon
看完这100个客户需求,我终于知道企业文档管理的秘密
typescript5 - compile and install ts code
hcip第八天
SQL injection vulnerability (postgresql injection)
函数(1)
IDEA设置System.out.println()和main方法快捷键
【三子棋】——玩家VS电脑(C语言实现)
Max Sum Plus Plus HDU - 1024
[GAN]老照片修复Bringing Old Photos Back to Life论文总结
OA项目之待开会议&历史会议&所有会议
Hands-on teaching OneOS FOTA upgrade
SQL window function
SQL注入漏洞(postgresql注入)