当前位置:网站首页>The project parameters are made into configurable items, and the @configurationproperties annotation is used
The project parameters are made into configurable items, and the @configurationproperties annotation is used
2022-07-27 04:27:00 【Time is an antidote】
The project parameters are made into configurable items ,@ConfigurationProperties Use of annotations
The problem background
In the project , Many parameters need to be configurable , Now and there is nacos Support for , Configurable without restarting , Dynamic changes , Very convenient
ConfigurationProperties Use
1 Import prompt depends
<!-- Configure the prompt tool of the page -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
2 Create configurable classes
package com.lanran.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
/** * @Description: * @Created: IDEA2021 * @author: Blue dye * @createTime: 2022-07-23 20:28 **/
// Bind to configuration file , The prefix for lanran.thread
@ConfigurationProperties(prefix = "lanran.thread")
// @Component
@Data
public class ThreadPoolConfigProperties {
private Integer coreSize;
private Integer maxSize;
private Integer keepAliveTime;
}
3 application Sample configuration file
# Configure thread pool , Configurable file
lanran.thread.coreSize=20
lanran.thread.maxSize=200
lanran.thread.keepAliveTime=10
As a programmer 216 An article , Write one line of lyrics at a time and record , Look at how many songs there are in life ,wahahaha …


Lyric: If you dry, you won't be visible
边栏推荐
- 深度剖析 —— 动态内存管理
- c# 获取uuid
- [MySQL series] MySQL index transactions
- ISG index shows that the it and business service market in the Asia Pacific region fell sharply in the second quarter
- 【比赛参考】PyTorch常用代码段以及操作合集
- 一张图看懂KingbaseES V9
- Webpack packaging Vue project adds confusion to solve the cache problem
- GenericServlet为什么有两个init方法
- 356 pages, 140000 words, weak current intelligent system of high-end commercial office complex, 2022 Edition
- els 方块显示原理
猜你喜欢

卷积神经网络——24位彩色图像的卷积的详细介绍

Is VR panorama just needed now? After reading it, you will understand

Eureka-服务注册中心

第二轮Okaleido Tiger即将登录Binance NFT,或持续创造销售神绩

JMeter download and installation

Anonymous named pipes, understanding and use of interprocess communication in shared memory

Ribbon load balancing strategy and configuration, lazy loading and hungry loading of ribbon

influxDB 基础了解

Introduction to JVM principle

Navicat将MySQL导出表结构以及字段说明
随机推荐
[machine learning network] BP neural network and deep learning-6 deep neural networks (DNN)
第二轮Okaleido Tiger即将登录Binance NFT,或持续创造销售神绩
js修改对象数组的key值
Hash (hash)
Install and configure Debian on a wired network
Ribbon负载均衡策略与配置、Ribbon的懒加载和饥饿加载
Okaleido tiger will log in to binance NFT in the second round, or continue to create sales achievements
Deep analysis - dynamic memory management
Analysis of three common kinematic models of mobile chassis
2022 operation of simulated examination question bank and simulated examination platform for safety production management personnel of hazardous chemical production units
Cool Lehman VR panorama paves the way for you to start a business
Rust:axum学习笔记(1) hello world
Principle of bean validation --07
BigDecimal踩坑总结&最佳实践
sram、dram、sdram、ddr的区别和用途
JS modify the key value of the object array
GenericServlet为什么有两个init方法
STM32基于HAL库的串口接受中断和空闲中断
Convolution neural network -- convolution of gray image
数据分析师岗位分析