File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Spring_part_14/src/main/java/spring/oldboy/config Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 1+ package spring .oldboy .config ;
2+
3+ import org .springframework .beans .factory .annotation .Value ;
4+ import org .springframework .beans .factory .config .BeanDefinition ;
5+ import org .springframework .context .annotation .Bean ;
6+ import org .springframework .context .annotation .Configuration ;
7+ import org .springframework .context .annotation .Scope ;
8+ import spring .oldboy .database .pool .ConnectionPool ;
9+
10+ @ Configuration
11+ public class ApplicationConfiguration {
12+
13+ @ Bean ("pool2" )
14+ @ Scope (BeanDefinition .SCOPE_SINGLETON )
15+ public ConnectionPool pool2 (@ Value ("${db.username}" ) String username ) {
16+ return new ConnectionPool (username , 20 );
17+ }
18+
19+ @ Bean
20+ public ConnectionPool pool3 () {
21+ return new ConnectionPool ("test-pool" , 25 );
22+ }
23+
24+ }
You can’t perform that action at this time.
0 commit comments