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

边栏推荐
猜你喜欢

Intersection of Boolean Operations in SuperMap iDesktop.Net - Repairing Complex Models with Topological Errors

龙蜥社区第二届理事大会圆满召开!理事换届选举、4 位特约顾问加入

使用二维码传输文件的小工具 - QFileTrans 1.2.0.1

Go 微服务开发框架 DMicro 的设计思路

2022-08-04: Input: deduplicated array arr, the numbers in it only contain 0~9.limit, a number.Return: The maximum number that can be spelled out with arr if the requirement is smaller than limit.from

The design idea of DMicro, the Go microservice development framework

线上MySQL的自增id用尽怎么办?

基于左序遍历的数据存储实践

Use SuperMap iDesktopX data migration tool to migrate map documents and symbols

How OpenGL works
随机推荐
Turn: Charles Handy: Who you are is more important than what you do
dmp(dump)转储文件
QT language file production
Regular expression to match a certain string in the middle
如何在WordPress中添加特定类别的小工具
Flink 1.15.1 Cluster Construction (StandaloneSession)
Distributed systems revisited: there will never be a perfect consistency scheme...
龙蜥社区第二届理事大会圆满召开!理事换届选举、4 位特约顾问加入
[机缘参悟-60]:《兵者,诡道也》-2-孙子兵法解读
dmp (dump) dump file
Data to enhance Mixup principle and code reading
torch.roll()
What should I do if the self-incrementing id of online MySQL is exhausted?
Syntax basics (variables, input and output, expressions and sequential statements)
QT: The Magical QVarient
冒泡排序与快速排序
解决connect: The requested address is not valid in its context
In 2022, you still can't "low code"?Data science can also play with Low-Code!
QT MV\MVC structure
引领数字医学高地,中山医院探索打造未来医院“新范式”