File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed
spring-framework-reference/src Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -1491,14 +1491,26 @@ public class JndiDataConfig {
14911491}</programlisting >
14921492
14931493 <programlisting language =" java" >@Configuration
1494- @Profile("production")
1495- public class JndiDataConfig {
1494+ public class TransferServiceConfig {
1495+
1496+ @Autowired DataSource dataSource;
14961497
14971498 @Bean
1498- public DataSource dataSource() throws Exception {
1499- Context ctx = new InitialContext();
1500- return (DataSource) ctx.lookup("java:comp/env/jdbc/datasource" );
1499+ public TransferService transferService() {
1500+ return new DefaultTransferService(accountRepository(),
1501+ feePolicy() );
15011502 }
1503+
1504+ @Bean
1505+ public AccountRepository accountRepository() {
1506+ return new JdbcAccountRepository(dataSource);
1507+ }
1508+
1509+ @Bean
1510+ public FeePolicy feePolicy() {
1511+ return new ZeroFeePolicy();
1512+ }
1513+
15021514}</programlisting >
15031515
15041516 <programlisting language =" java" >package com.bank.service;
You can’t perform that action at this time.
0 commit comments