Java spring-boot中tomcat的默认连接池?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35452217/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Default connection pool for tomcat in spring-boot?
提问by membersound
What is the default value used for maximum connections on a postgres
database with tomcat
connection pooling using spring-boot
?
使用连接池的postgres
数据库上最大连接数的默认值是多少?tomcat
spring-boot
There is a property spring.datasource.maxActive
, but when I try to sysout it, I'm getting an exception:
有一个 property spring.datasource.maxActive
,但是当我尝试对其进行 sysout 时,出现异常:
@Value("${spring.datasource.maxActive}")
private String act;
java.lang.IllegalArgumentException: Could not resolve placeholder 'spring.datasource.maxActive' in string value "${spring.datasource.maxActive}
java.lang.IllegalArgumentException: Could not resolve placeholder 'spring.datasource.maxActive' in string value "${spring.datasource.maxActive}
采纳答案by WeMakeSoftware
According to org.apache.tomcat.jdbc.pool.PoolProperties
the default value is 100
根据org.apache.tomcat.jdbc.pool.PoolProperties
默认值是100
回答by sag
You need to set spring.datasource.max-active in your application.properties or application.yaml to get the value in your bean class
您需要在 application.properties 或 application.yaml 中设置 spring.datasource.max-active 以获取 bean 类中的值
Refer https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.htmlfor common application.properties
常见的 application.properties参考https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html