当前位置:网站首页>静态方法获取配置文件数据
静态方法获取配置文件数据
2022-08-05 03:05:00 【zhanghe_zht】
编写工具类中遇到注入配置文件中的数据读取不到,解决办法
1.工具类要用@Component修饰
2.使用@Value注解将配置文件中的数据注入到普通变量中
3.通过@PostConstruct注解将普通变量赋值给静态变量
通过以上步骤静态方法中就可以获取到配置文件中的数据了

边栏推荐
- QT MV\MVC structure
- 1527. Patients suffering from a disease
- Review 51 MCU
- [In-depth study of 4G/5G/6G topic-51]: URLLC-16-"3GPP URLLC related protocols, specifications, and technical principles in-depth interpretation"-11-High reliability technology-2-Link adaptive enhancem
- 1484. 按日期分组销售产品
- undo problem
- [Fortune-telling-60]: "The Soldier, the Tricky Way"-2-Interpretation of Sun Tzu's Art of War
- Data storage practice based on left-order traversal
- View handler 踩坑记录
- 你要的七夕文案,已为您整理好!
猜你喜欢

Access Characteristics of Constructor under Inheritance Relationship

Ant Sword Advanced Module Development

剑指offer专项突击版第20天

【软件测试】自动化测试之unittest框架

tree table lookup

【七夕节】浪漫七夕,代码传情。将爱意变成绚烂的立体场景,给她(他)一个惊喜!(送代码)

2022-08-04 第六小组 瞒春 学习笔记

Matlab drawing 3

VSCode Change Default Terminal how to modify the Default Terminal VSCode

Data storage practice based on left-order traversal
随机推荐
View handler stepping record
word分栏小记
注意潍坊开具发票一般需要注意
云原生(三十二) | Kubernetes篇之平台存储系统介绍
解决connect: The requested address is not valid in its context
Use SuperMap iDesktopX data migration tool to migrate map documents and symbols
Native js realizes the effect of selecting and canceling all the multi-select boxes
In 2022, you still can't "low code"?Data science can also play with Low-Code!
sql server 安装提示用户名不存在
A small tool to transfer files using QR code - QFileTrans 1.2.0.1
语法基础(变量、输入输出、表达式与顺序语句完成情况)
HDU 1114:Piggy-Bank ← 完全背包问题
腾讯云【Hiflow】新时代自动化工具
undo problem
The design idea of DMicro, the Go microservice development framework
Solve connect: The requested address is not valid in its context
HDU 1114: Piggy-Bank ← The Complete Knapsack Problem
如何在WordPress中添加特定类别的小工具
QT MV\MVC结构
dmp (dump) dump file