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

边栏推荐
- 22-07-31周总结
- 2022了你还不会『低代码』?数据科学也能玩转Low-Code啦!
- 告白数字化转型时代,时速云镌刻价值新起点
- What should I do if the self-incrementing id of online MySQL is exhausted?
- QT MV\MVC结构
- Linux下常见的开源数据库,你知道几个?
- Summary of domestic environments supported by SuperMap
- Data to enhance Mixup principle and code reading
- Beidou no. 3 short message terminal high slope in open-pit mine monitoring programme
- View handler 踩坑记录
猜你喜欢

OpenGL 工作原理

VSCode Change Default Terminal 如何修改vscode的默认terminal

论治理与创新,2022 开放原子全球开源峰会 OpenAnolis 分论坛圆满落幕

【七夕节】浪漫七夕,代码传情。将爱意变成绚烂的立体场景,给她(他)一个惊喜!(送代码)
![[C language] Detailed explanation of stacks and queues (define, destroy, and data operations)](/img/7b/8b3f1e4f0000aa34fc1f8fff485765.png)
[C language] Detailed explanation of stacks and queues (define, destroy, and data operations)

mysql can't Execute, please solve it

word column notes

J9 Digital Currency: What is the creator economy of web3?

The usage of try...catch and finally in js

mysql没法Execute 大拿们求解
随机推荐
2022-08-04:输入:去重数组arr,里面的数只包含0~9。limit,一个数字。 返回:要求比limit小的情况下,能够用arr拼出来的最大数字。 来自字节。
线上MySQL的自增id用尽怎么办?
剑指offer专项突击版第20天
注意潍坊开具发票一般需要注意
Note that Weifang generally needs to pay attention to issuing invoices
通过模拟Vite一起深入其工作原理
Talking about data security governance and privacy computing
Programmer's Tanabata Romantic Moment
Summary of domestic environments supported by SuperMap
虚拟内存原理与技术
UOS系统下ksql应用缺少动态库”libtinfo.so.5“问题
Beidou no. 3 short message terminal high slope in open-pit mine monitoring programme
QStyle platform style
1873. 计算特殊奖金
语法基础(变量、输入输出、表达式与顺序语句完成情况)
CPDA|How Operators Learn Data Analysis (SQL) from Negative Foundations
Dynamic management of massive service instances
word column notes
(十一)元类
使用二维码传输文件的小工具 - QFileTrans 1.2.0.1