当前位置:网站首页>反射111
反射111
2022-04-21 20:52:00 【少年维持着emo】
@Component
public class DemoUtils {
public String d1(){
return "OK";
}
public static DemoUtils get(){
System.out.println("xxxx:"+DemoUtils.class);
return SpringUtils.applicationContext.getBean(DemoUtils.class);
}
}
@Component
public class SpringUtils implements ApplicationContextAware {
public static ApplicationContext applicationContext;
public SpringUtils() {
}
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
SpringUtils.applicationContext = applicationContext;
}
}
```
```java
@Test
void contextLoads() {
System.out.println(DemoUtils.get().d1());
}
```
版权声明
本文为[少年维持着emo]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_45592502/article/details/124317461
边栏推荐
- Live555学习
- SQL 错误: ORA-01428: 参数 ‘0‘ 超出范围 01428. 00000 - “argument ‘%s‘ is out of range“
- 项目管理系统开发成功案例
- 88%工业人都不知,小程序这7点,能让营收暴增,粗暴有效!强烈建议收藏,反复读!
- 常用网络工具4:SG 宽带工具
- 尿素期货几个点涨停?尿素期货怎么做才安全?
- 工作流操作说明
- Map&Set
- APM 行业认知系列 - 十二 - 十三
- [azure application service] after azure function enables managed identity, error appears in PowerShell function: managedidentitycredential authentication failed
猜你喜欢

Connection between Tongda OA and third-party app

Tracup|使用项目管理独一无二的六大好处

Tongda OA form countersignature comment style

He was in '98. I can't play with him

10.2注意力汇聚

What are the material requirements of the electric slip ring

3、MySQL Workbench 对表进行增删改查

25.<tag-数组和模拟>-lt- 31.下一个排列 + lt- 556. 下一个更大元素 III

【Daily LeetCoding Challenge14】 K 个一组翻转链表

在两个TIA博途项目中组态PROFIBUS和PROFINET通信的具体方法
随机推荐
uart学习
Go语言自学系列 | golang defer语句
SQL error: ora-01428: parameter '0' is out of range 00000 - “argument ‘%s‘ is out of range“
VS2019配置opencv4
Map&Set
Yaml
6、Qt使用MySQL例子
Pytorch中的nn.AdaptiveAvgPool2d(output_size)简单介绍
《动手学机器人学》7.2.3姿态的多种表示,四元数,欧拉角旋转矩阵、轴角ROS2
Matlab handle graphics
滑环接线最主要的看什么
DADI在缓存命中场景下的性能优势,核心设计在于什么?
track和trigger
使用foremost对磁盘镜像文件做数字取证
Yaml
MySQL数值函数
5、Qt使用MySQL
【高并发】不得不说的线程池与ThreadPoolExecutor类浅析
工作流 流程设置 定制开发
Mysql刷题题解_多表联查_运营想要计算一些参加了答题的不同学校、不同难度的用户平均答题量,请你写SQL取出相应数据