Rev 105 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 105 | Rev 139 | ||
---|---|---|---|
Line 120... | Line 120... | ||
120 | 120 | ||
121 | Container c = new MentaContainer(); |
121 | Container c = new MentaContainer(); |
122 | 122 | ||
123 | c.ioc("connection", Connection.class); // in real life this will be a connection pool factory... |
123 | c.ioc("connection", Connection.class); // in real life this will be a connection pool factory... |
124 | 124 | ||
125 | c.ioc("accountDAO", JdbcAccountDAO.class). |
125 | c.ioc("accountDAO", JdbcAccountDAO.class).addConstructorDependency("connection"); |
126 | 126 | ||
127 | AccountDAO accountDAO = c.get("accountDAO"); |
127 | AccountDAO accountDAO = c.get("accountDAO"); |
128 | 128 | ||
129 | System.out.println(accountDAO.getBalance(25)); // => 1000000 |
129 | System.out.println(accountDAO.getBalance(25)); // => 1000000 |
130 | }
|
130 | }
|