当前位置:网站首页>[configuration related]
[configuration related]
2022-07-29 10:08:00 【Zanzaner_】
List of articles
One [email protected]&@ImportResource&@Bean
@PropertySource: Load the specified configuration file ;
@ImportResource: Import Spring Configuration file for , Let the content in the configuration file take effect ;SpringBoot Recommended ways to add components to a container ; It is recommended to use full annotation
1、 Configuration class @Configuration------>Spring The configuration file 2、 Use @Bean Add components to the container
Two . Profile
1、 many Profile file
When we write the main configuration file , The filename can be application-{profile}.properties/yml
By default application.properties Configuration of ;
2、yml Support multi document block mode
active: prod // Activate assignment profile
server:
port: 8081
spring:
profiles:
active: prod
---
server:
port: 8083
spring:
profiles: dev
---
server:
port: 8084
spring:
profiles: prod
3、 Activate assignment profile
①、 Specified in the configuration file spring.profiles.active=dev
②、 Command line :
java -jar spring-boot-02-config-0.0.1-SNAPSHOT.jar --spring.profiles.active=dev;
You can test it directly , Configure the incoming command line parameters
③、 Virtual machine parameters ;
-Dspring.profiles.active=dev
3、 ... and . Configuration file loading location
springboot Startup will scan the following locations application.properties perhaps application.yml File as Spring boot Default configuration file
–file:./config/
–file:./
–classpath:/config/
–classpath:/
Priority from high to low , High priority configuration overrides low priority configuration ;
SpringBoot The main configuration file will be loaded from all four locations ; Complementary configuration ;
Four . External configuration loading order
SpringBoot You can also load the configuration from ; Priority from high to low ; The high priority configuration covers the low priority configuration , All configurations form complementary configurations
Spring Boot Support multiple external configuration modes
The priority of these methods is as follows :
https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-features-external-config
5、 ... and . Auto configuration principle
边栏推荐
- [jetson][转载]jetson上安装pycharm
- 什么是卡特兰数?有哪些应用?
- Dynamics 365Online 如何自定义商机关闭窗体
- Some suggestions for programmers to leave single
- 10 suggestions for 10x improvement of application performance
- 【黑马早报】每日优鲜回应解散,多地已无法下单;李斌称蔚来将每年出一部手机;李嘉诚欲抄底恒大香港总部大楼;今年国庆休7天上7天...
- SAP Fiori @OData. Analysis of the working principle of publish annotation
- 【AAAI】用于交通流预测的基于注意力的时空图卷积网络
- [FPGA tutorial case 19] factorial operation through multiplier
- TMS320C6000_ Tms320f28035 Chinese data manual
猜你喜欢
SiC功率半导体产业高峰论坛成功举办
Geeer's happiness | is for the white whoring image! Analysis and mining, NDVI, unsupervised classification, etc
[FPGA tutorial case 19] factorial operation through multiplier
一文读懂Plato Farm的ePLATO,以及其高溢价缘由
[ts]typescript learning record pit collection
[jetson][reprint]pycharm installed on Jetson
A little knowledge ~ miscellaneous notes on topics ~ a polymorphic problem
Is there any charge for PDF processing? impossible
Shell notes (super complete)
综合设计一个OPPE主页--页面的底部
随机推荐
JS 实现全屏效果
Excel tool for generating database table structure
Is there any charge for PDF processing? impossible
[wechat applet] interface generates customized homepage QR code
高效能7个习惯学习笔记
mysql 数据库 期末复习题库
综合设计一个OPPE主页--页面的底部
Network picture to local picture - default value or shortcut key
CS research assurance experience in 2021 (VI): system filling + some thoughts
机器学习之逻辑回归(Logistics Regression)
Is it safe to open an account online now? Do you want to know that you must go to the business hall to open an account now?
How can Plato obtain premium income through elephant swap in a bear market?
Intel joins hands with datawhale to launch learning projects!
After the thunderstorm of two encryption companies: Celsius repayment guarantee collateral, three arrow capital closed and disappeared
跟着田老师学实用英语语法(持续更新)
Functions and arrays
2021年CS保研经历(六):系统填报 + 一些感想
【AAAI】用于交通流预测的基于注意力的时空图卷积网络
函数——(C游记)
English语法_不定代词 - 常用短语