当前位置:网站首页>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
}
边栏推荐
- PCL point cloud processing: creating a two-dimensional grid to organize point cloud data (64)
- VC prompts to recompile every time you press F5 to run
- IndexTree
- Enterprise operation we media can't "self Hi": the content should be grounded, not advertising
- [zero basis] SQL injection for PHP code audit
- 工业物联网中的时序数据
- Uniform sampling and thinning of PCL point cloud processing (61)
- yolov5
- 图结构的实现,从点到边再到图
- Ranking of engineering project management software
猜你喜欢

【数据库学习】Redis 解析器&&单线程&&模型

聊聊 Redis 是如何进行请求处理

Glidemodule appglidemodule and generated API details

Old Du servlet JSP

QT6 with vs Code: compiling source code and basic configuration
WPF uses pathgeometry to draw the hour hand and minute hand

工业物联网中的时序数据

单调栈结构练习——子数组最小值的累加和

IndexTree2D

Network Security Learning (III) basic DOS commands
随机推荐
Boundary extraction of PCL point cloud processing (58)
Helm -- a powerful package management tool for kubernetes applications
PCD file of PCL point cloud processing to TXT file (single or multiple batch conversion) (63)
ASP.NET Core 6.0 基于模型验证的数据验证
Some analysis of slow MySQL query
老杜Servlet-JSP
IndexTree
并查集结构
从暴力递归到动态规划,记忆化搜索
Projection regularization of line point set in PCL point cloud processing (56)
Trinitycore worldofwarcraft server - registration website
Let‘s Encrypt
Cross entropy loss
JUC concurrent programming - Advanced 05 - lock free of shared model (CAS | atomic integer | atomic reference | atomic array | field updater | atomic accumulator | unsafe class)
Network Security Learning (II) IP address
The tragic experience of installing scikitlearn on win764
Archsummit: evolution of the underlying framework of cherished microservices
EL & JSTL: JSTL summary
[cloud native] Devops (IV): integrated sonar Qube
Notes of Teacher Li Hongyi's 2020 in-depth learning series lecture 1