spring-boot中tomcat的默认连接池?

时间:2016-02-17 09:10:04

标签: java spring postgresql tomcat spring-boot

使用postgres tomcat连接池的spring-boot数据库上的最大连接使用的默认值是什么?

有一个属性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}

2 个答案:

答案 0 :(得分:9)

根据<header> <div id="banner"> <div class="container"> <div id="banner-inner"> <div id="banner-left"> <h1>Site Name</h1> <p>Some catchy slogan...</p> </div> <div id="banner-right"> <div id="banner-top"> <ul> <li>Find Me On:</li> <li><a href+ "#" title="Facebook"><i class="fa fa-facebook-square"></i></a></li> <li><a href+ "#" title="Twitter"><i class="fa fa-twitter-square"></i></a></li> <li><a href+ "#" title="LinkedIn"><i class="fa fa-linkedin-square"></i></a></li> <li><a href+ "#" title="Instagram"><i class="fa fa-instagram"></i></a></li> </ul> </div> <div id="banner-bottom"> <nav> <ul id="menu-menu-1" class="nav navbar-nav"> <li><a title="Home" href+ "#">Home</a></li> <li><a title="Blog" href+ "#">Blog</a></li> <li><a title="Resources" href+ "#" data-toggle="dropdown" class="dropdown-toggle" aria-haspopup="true">Resources <span class="caret"></span></a> <ul role="menu" class=" dropdown-menu"> <li><a title="HTML &amp; CSS" href+ "#">HTML &#038; CSS</a></li> <li><a title="JavaScript &amp; jQuery" href+ "#">JavaScript &#038; jQuery</a></li> <li><a title="PHP" href+ "#">PHP</a></li> <li><a title="MySQL" href+ "#">MySQL</a></li> </ul> </li> <li><a title="Portfolio" href+ "#" data-toggle="dropdown" class="dropdown-toggle" aria-haspopup="true">Portfolio <span class="caret"></span></a> <ul role="menu" class=" dropdown-menu"> <li><a title="Web Designs" href+ "#">Web Designs</a></li> <li><a title="Photo Gallery" href+ "#">Photo Gallery</a></li> <li><a title="Development Projects" href+ "#">Development Projects</a></li> <li><a title="Graphic Designs" href+ "#">Graphic Designs</a></li> </ul> </li> <li><a title="Services" href+ "#">Services</a></li> <li><a title="About" href+ "#">About</a></li> <li><a title="Contact" href+ "#">Contact</a></li> </ul> </nav> </div> </div> </div> </div> </div> </header>,默认值为org.apache.tomcat.jdbc.pool.PoolProperties

答案 1 :(得分:1)

您需要在application.properties或application.yaml中设置spring.datasource.max-active以获取bean类中的值

请参阅https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html以了解常见的application.properties