当前位置:网站首页>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容器里面
边栏推荐
猜你喜欢
【CC3200AI 实验教程 1】疯壳·AI语音人脸识别(会议记录仪/人脸打卡机)-开发环境搭建
1319_STM32F103串口BootLoader移植
【PCBA program design】Grip dynamometer program
In action: 10 ways to implement delayed tasks, with code!
Unknown point cloud structure file conversion requirements
DSPE-PEG-Aldehyde,DSPE-PEG-CHO,磷脂-聚乙二醇-醛基一种疏水18碳磷脂
Axure9基本交互操作(一)
强网杯2022——WEB
The upgrade and transformation plan of the fortress machine for medium and large commercial banks!Must see!
数字重塑客观世界,全空间GIS发展正当其时
随机推荐
中大型商业银行堡垒机升级改造方案!必看!
数电快速入门(五)(编码器的介绍以及通用编码器74LS148和74LS147的介绍)
如何一键重装Win11系统 一键重装系统方法
Go----Go 语言基础之标识符、关键字、命名规范、变量、常量
js数据类型、节流/防抖、点击事件委派优化、过渡动画
数电快速入门(二)(复合逻辑运算和逻辑代数的基本定律的介绍)
信创是什么意思?涉及哪些行业?为什么要发展信创?
《剑指offer》刷题分类
2022强网杯web(部分)
驱动点云格式修改带来的效率提升
Altium Designer 19.1.18 - draw polygons copper hollow out, for the cursor just capture solutions
可视化工作流引擎开发OA系统,让企业少花冤枉钱
How to solve the problem that the alarm information cannot be transmitted after EasyGBS is connected to the latest version of Hikvision camera?
PMP证书在哪些行业有用?
Yolov7:Trainable bag-of-freebies sets new state-of-the-art for real-time objectdetectors
[2022 Nioke Duo School 5 A Question Don't Starve] DP
如何一键重装win7系统?重装win7系统详细教程
Arduino 电机测速
AXI interface application of Zynq Fpga image processing - the use of axi_lite interface
立方度量(Cubic Metric)