当前位置:网站首页>静态方法获取配置文件数据
静态方法获取配置文件数据
2022-08-05 03:05:00 【zhanghe_zht】
编写工具类中遇到注入配置文件中的数据读取不到,解决办法
1.工具类要用@Component修饰
2.使用@Value注解将配置文件中的数据注入到普通变量中
3.通过@PostConstruct注解将普通变量赋值给静态变量
通过以上步骤静态方法中就可以获取到配置文件中的数据了
边栏推荐
- 引领数字医学高地,中山医院探索打造未来医院“新范式”
- How Jin Cang database correctness verification platform installation file
- 开源协议说明LGPL
- What should I do if the self-incrementing id of online MySQL is exhausted?
- Native js realizes the effect of selecting and canceling all the multi-select boxes
- Simple description of linked list and simple implementation of code
- 数据增强Mixup原理与代码解读
- Question about #sql shell#, how to solve it?
- 【 genius_platform software platform development 】 : seventy-six vs the preprocessor definitions written cow force!!!!!!!!!!(in the other groups conding personnel told so cow force configuration to can
- Matlab drawing 3
猜你喜欢
View handler stepping record
Multithreading (2)
Flink 1.15.1 Cluster Construction (StandaloneSession)
The Tanabata copywriting you want has been sorted out for you!
The 20th day of the special assault version of the sword offer
Ant Sword Advanced Module Development
龙蜥社区第二届理事大会圆满召开!理事换届选举、4 位特约顾问加入
Cloud Native (32) | Introduction to Platform Storage System in Kubernetes
The design idea of DMicro, the Go microservice development framework
Beidou no. 3 short message terminal high slope in open-pit mine monitoring programme
随机推荐
Principle and Technology of Virtual Memory
Go 微服务开发框架 DMicro 的设计思路
ASP.NET应用程序--Hello World
北斗三号短报文终端露天矿山高边坡监测方案
Ant Sword Advanced Module Development
使用二维码传输文件的小工具 - QFileTrans 1.2.0.1
Error: Not a signal or slot declaration
The problem of lack of dynamic library "libtinfo.so.5" in ksql application under UOS system
J9 Digital Currency: What is the creator economy of web3?
Apache DolphinScheduler, a new generation of distributed workflow task scheduling platform in practice - Medium
Syntax basics (variables, input and output, expressions and sequential statements)
rpc-remote procedure call demo
【软件测试】自动化测试之unittest框架
private package
沃谈小知识 |“远程透传”那点事儿
Review 51 MCU
冒泡排序与快速排序
627. Change of gender
Native js realizes the effect of selecting and canceling all the multi-select boxes
软链接引发的物理备份问题