池化配置
2024/12/19大约 1 分钟通用属性
[一]对象池配置
max-total
- Type:
Integer
- Default:
8
池中的最大对象数
max-idle
- Type:
Integer
- Default:
8
最多的空闲对象数
min-idle
- Type:
Integer
- Default:
0
最少的空闲对象数
lifo
- Type:
Boolean
- Default:
true
对象池存放池化对象方式,true放在空闲队列最前面,false放在空闲队列最后
max-wait
- Type:
Duration
- Default:
-1L
当连接池资源耗尽时,调用者最大阻塞的时间,超时时抛出异常。-1L 意味着立即抛出。
注
需要使用 Spring Boot Duration 类型参数配置的格式进行配置
- ns for nanoseconds (纳秒)
- us for microseconds (微秒)
- ms for milliseconds (毫秒)
- s for seconds (秒)
- m for minutes (分)
- h for hours (时)
- d for days (天)
block-when-exhausted
- Type:
Boolean
- Default:
true
对象池满了,是否阻塞获取(false则借不到直接抛异常), 默认 true
min-evictable-idle-duration
- Type:
Duration
- Default: 30m
空闲的最小时间,达到此值后空闲连接可能会被移除, 默认30分钟
注
需要使用 Spring Boot Duration 类型参数配置的格式进行配置
- ns for nanoseconds (纳秒)
- us for microseconds (微秒)
- ms for milliseconds (毫秒)
- s for seconds (秒)
- m for minutes (分)
- h for hours (时)
- d for days (天)
soft-min-evictable-idle-duration
- Type:
Duration
- Default: -1
软最小可清除空闲持续时间
注
需要使用 Spring Boot Duration 类型参数配置的格式进行配置
- ns for nanoseconds (纳秒)
- us for microseconds (微秒)
- ms for milliseconds (毫秒)
- s for seconds (秒)
- m for minutes (分)
- h for hours (时)
- d for days (天)
贡献者
码匠君