当前位置:网站首页>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
边栏推荐
- Some common instructions in JVM tuning
- Elastic certification test: 30 day FastPass Study Guide
- Px4 module design 12: high resolution timer design
- 【机器学习网络】BP神经网络与深度学习-6 深度神经网络(deep neural Networks DNN)
- 452 pages, 130000 words, the overall solution of modern smart Township Xueliang project 2022 Edition
- Why does genericservlet have two init methods
- 利用JSON类型在mysql中实现数组功能
- Navicat将MySQL导出表结构以及字段说明
- scala 不可变Map 、 可变Map 、Map转换为其他数据类型
- [leetcode] day104 no overlapping interval
猜你喜欢

Overview of communication protocols

记一次TCP丢包带来的重大性能问题

匿名命名管道, 共享内存的进程间通信理解与使用

Cool Lehman VR panorama paves the way for you to start a business

使用WebMvcConfigurer进行接口请求拦截进行中增强(附源码)

Network knowledge corner | it only takes four steps to teach you to use SecureCRT to connect to ENSP. You must see the operation guide of common tools

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

From scratch, C language intensive Lecture 4: array

Plato farm has a new way of playing, and the arbitrage eplato has secured super high returns

Deep analysis - dynamic memory management
随机推荐
C get UUID
Network knowledge corner | it only takes four steps to teach you to use SecureCRT to connect to ENSP. You must see the operation guide of common tools
Eureka service registry
Ribbon load balancing strategy and configuration, lazy loading and hungry loading of ribbon
The new Internet era has come. What new opportunities will Web 3.0 bring us
匿名命名管道, 共享内存的进程间通信理解与使用
2022-07-26:以下go语言代码输出什么?A:5;B:hello;C:编译错误;D:运行错误。 package main import ( “fmt“ ) type integer in
VR panorama gold rush "careful machine" (Part 1)
Leetcode daily exercise: sort sentences
Wechat input component adds a clear icon, and clicking clear does not take effect
P1438 无聊的数列 线段树+差分
Why does genericservlet have two init methods
ISG index shows that the it and business service market in the Asia Pacific region fell sharply in the second quarter
Elastic认证考试:30天必过速通学习指南
ROS camera calibration sensor_ Msgs/camerainfo message data type and meaning
Five basic data structures of redis
你了解微信商户分账吗?
2022 retraining question bank and answers for main principals of hazardous chemical business units
记一次TCP丢包带来的重大性能问题
微信input组件添加清除图标,点击清空不生效