Skip to content

Commit f0ded6a

Browse files
committed
[SPR-8401] Added missing TransferServiceConfig code listing.
1 parent dc95e49 commit f0ded6a

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

spring-framework-reference/src/testing.xml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff 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;

0 commit comments

Comments
 (0)