使用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}
答案 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 & CSS" href+ "#">HTML & CSS</a></li>
<li><a title="JavaScript & jQuery" href+ "#">JavaScript & 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