当前位置:网站首页>如何创建和管理自定义的配置信息
如何创建和管理自定义的配置信息
2022-07-24 22:31:00 【InfoQ】
如何在应用程序中嵌入系统配置信息
myapplication.name : ${spring.application.name}
system.name=springcss
system.domain=health
system.description=The system ${name} is used for ${domain}.
info:
app:
encoding: @[email protected]
java:
source: @[email protected]
target: @[email protected]
info:
app:
encoding: UTF-8
java:
source: 1.8.0_31
target: 1.8.0_31
如何创建和使用自定义配置信息
springcss.order.point = 10
使用 @Value 注解
@Component
public class SpringCssConfig {
@Value("${springcss.order.point}")
private int point;
}
使用 @ConfigurationProperties 注解
@Component
@ConfigurationProperties(prefix = "springcss.order")
public class SpringCsshConfig {
private int point;
//省略 getter/setter
}
springcss:
points:
orderType[1]: 10
orderType[2]: 20
orderType[3]: 30
@Component
@ConfigurationProperties(prefix="springcss.points")
public class SpringCssConfig {
private Map<String, Integer> orderType = new HashMap<>();
//省略 getter/setter
}
边栏推荐
- [Apipost和Apifox哪个更好用?看这篇就够了!]
- Okaleido tiger NFT is about to log in to binance NFT platform, and the future market continues to be optimistic
- PCL point cloud processing to find the two endpoints of the line point set (57)
- PCL点云处理之平面规则化(五十五)
- Flex layout
- "Fundamentals of program design" Chapter 10 function and program structure 6-13 divide and conquer method to solve the gold bullion problem (20 points)
- Application programming of communication heartbeat signal for communication abnormality judgment
- PCL点云处理之创建二维格网组织点云数据(六十四)
- RichTextBox operation
- Available parameters of ansible Playbook
猜你喜欢

Visual studio input! No prompt

【1184. 公交站间的距离】

Go+ language

Some analysis of slow MySQL query

由斐波那契数列引述到矩阵快速幂技巧

Morris traversal

暴力递归——N皇后详解 && 如何用位运算进行优化

The kettle job implementation runs a kettle conversion task every 6S

From violent recursion to dynamic programming, memory search

About constant modifier const
随机推荐
窗口内最大值或最小值的更新结构——窗口内最大值
WPF opens external programs and activates them when needed
A compatible, smaller and easy-to-use web font API
What is a video content recommendation engine?
Outlook邮件创建的规则失效,可能的原因
VC prompts to recompile every time you press F5 to run
头脑风暴之——利用reduce方法重构concat函数
CA certificate production practice
Enterprise operation we media can't "self Hi": the content should be grounded, not advertising
"Yuan universe 2086" outsold "San ti" in one-day sales and won the champion of JD books' one-day science fiction list
解决JSP无法使用session.getAttribute()
有序表之AVL树
Archsummit: evolution of the underlying framework of cherished microservices
Baidu online disk +chrome plug-in
Process / thread synchronization mechanism
CA证书制作实战
Use kettle to read the data in Excel file and store it in MySQL
The rule created by outlook mail is invalid. Possible reasons
Talk about how redis handles requests
用VS Code搞Qt6:编译源代码与基本配置