当前位置:网站首页>How to create and manage customized configuration information
How to create and manage customized configuration information
2022-07-24 22:48:00 【InfoQ】
How to embed system configuration information in an application
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
How to create and use custom configuration information
springcss.order.point = 10
Use @Value annotation
@Component
public class SpringCssConfig {
@Value("${springcss.order.point}")
private int point;
}
Use @ConfigurationProperties annotation
@Component
@ConfigurationProperties(prefix = "springcss.order")
public class SpringCsshConfig {
private int point;
// Omit 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<>();
// Omit getter/setter
}
边栏推荐
- 生成式对抗网络的效果评估
- Org.json Jsonexception: what about no value for value
- Connector in C
- Enterprise operation we media can't "self Hi": the content should be grounded, not advertising
- [cloud native] Devops (IV): integrated sonar Qube
- PCD file of PCL point cloud processing to TXT file (single or multiple batch conversion) (63)
- Luogu p2024 [noi2001] food chain
- Glidemodule appglidemodule and generated API details
- Multi task face attribute analysis based on deep learning (based on paddlepaddle)
- Process / thread synchronization mechanism
猜你喜欢
随机推荐
Which is the best interface documentation tool at home and abroad?
CA证书制作实战
ODBC executes stored procedure to get return value
Time series data in industrial Internet of things
EL & JSTL: JSTL summary
The rule created by outlook mail is invalid. Possible reasons
Boundary extraction of PCL point cloud processing (58)
Get the solution to the slow running speed of Mengxin Xiaobai computer! ٩ ( ‘ ω‘ )و get! ٩ ( ‘ ω‘ )و
一文读懂Elephant Swap的LaaS方案的优势之处
【数据库学习】Redis 解析器&&单线程&&模型
暴力递归——N皇后详解 && 如何用位运算进行优化
PCD file of PCL point cloud processing to TXT file (single or multiple batch conversion) (63)
[database learning] redis parser & single thread & Model
Notes of Teacher Li Hongyi's 2020 in-depth learning series lecture 1
Segment tree,,
10 key points and 5 measures for good project management
From violent recursion to dynamic programming, memory search
The kettle job implementation runs a kettle conversion task every 6S
Background image and QR code synthesis
高阶产品如何提出有效解决方案?(1方法论+2案例+1清单)









