当前位置:网站首页>Autowired自动装配
Autowired自动装配
2022-08-04 21:39:00 【Pr Young】
自动装配本来指工业上用机器代替人,来自动的完成一些组装任务
在spring和springboot里面是指将spring容器里面的bean和需要这个bean的类,自动组装在一起
(1)引入redis的依赖:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>(2)将RedisTemplate对象注入到Spring容器里面:
@Autowired
private RedisTemplate redisTemplate;另一个实际的例子:
@Autowired
//自动装配
private AuthenticationManager authenticationManager;
@Override
//返回一个Map,键和值都是字符串
public Map<String, String> login(String username, String password)
{
authenticationManager.authenticate();
}将AuthenticationManager类的对象authenticationManager注入到spring容器里面
边栏推荐
- 数电快速入门(一)(BCD码和三种基本逻辑运算的介绍)
- 热力学相关的两个定律
- Altium Designer 19.1.18 - Protecting Locked Objects
- Driving point cloud format changes bring efficiency improvement
- Webmine Webpage Mining Trojan Analysis and Disposal
- 《剑指offer》刷题分类
- 【线性代数02】AX=b的2种解释和矩阵乘法的5种视角
- webmine网页挖矿木马分析与处置
- 基于 Milvus 和 ResNet50 的图像搜索(部署及应用)
- deepstream多相机显示布局
猜你喜欢
随机推荐
JdbcTemplate概述和测试
Spss-系统聚类软件实操
dotnet enables JIT multi-core compilation to improve startup performance
Analysis and treatment of Ramnit infectious virus
Webmine Webpage Mining Trojan Analysis and Disposal
七夕,当爱神丘比特遇上牛郎和织女
【uiautomation】微信好友列表获取(存储到txt中)
OD-Model [6]: YOLOv2
[2022 Nioke Duo School 5 A Question Don't Starve] DP
基于 Milvus 和 ResNet50 的图像搜索(部署及应用)
LeetCode: 406. 根据身高重建队列
Altium Designer 19.1.18 - 保护锁定的对象
ROS packages visualization
开发deepstram的自定义插件,使用gst-dseaxmple插件进行扩充,实现deepstream图像输出前的预处理,实现图像自定义绘制图(精四)
NFT宝典:你需要知道NFT的术语和定义
ES6高级-async的用法
SPSS-System Clustering Software Practice
2022年江苏省大学生电子设计竞赛(TI杯)B题 飞机 省级一等奖记录 “一个摆烂人的独白”
dotnet delete read-only files
win10 uwp use WinDbg to debug








![[larave]关于laravel使用form submit()不能获取值问题](/img/2f/a7a17b1497390509edd6d096e8e473.png)
