当前位置:网站首页>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码和三种基本逻辑运算的介绍)

基于 Milvus 和 ResNet50 的图像搜索(部署及应用)

LeetCode 199: 二叉树的右视图

数电快速入门(三)(卡诺图化简法的介绍)

Codeforces Round #811 (Div. 3)

Is the International Project Manager PMP certificate worth taking?

DGL安装教程

JWT主动校验Token是否过期

基于声卡实现的音频存储示波器,可作为电磁学实验的测量仪表

In action: 10 ways to implement delayed tasks, with code!
随机推荐
milvus配置相关
matlab drawing
Pinduoduo open platform order information query interface [pdd.order.basic.list.get order basic information list query interface (according to transaction time)] code docking tutorial
用Tesseract开发一个你自己的文字识别应用
[QT] Implementation of callback function
立即升级!WPS Office 出现 0day 高危安全漏洞:可完全接管系统,官方推出紧急更新
In which industries is the PMP certificate useful?
Moke, dynamic image resource package display
SPSS-unary regression practice
【线性代数02】AX=b的2种解释和矩阵乘法的5种视角
deepstream多相机显示布局
UnicodeDecodeError: ‘utf-8‘ codec can‘t decode byte 0xd6 in position 120: invalid continuation byte
立方度量(Cubic Metric)
js data type, throttling/anti-shake, click event delegation optimization, transition animation
【线性代数03】消元法展示以及AX=b的4种解情况
1.读写点云文件
看看XDOC如何做Word文档预览
boostrap多选PID查找端口 window
LeetCode: 406. 根据身高重建队列
DSPE-PEG-Aldehyde,DSPE-PEG-CHO,磷脂-聚乙二醇-醛基一种疏水18碳磷脂