Skip to content

Commit 61b5b1e

Browse files
committed
Fix example for @⁠ImportResource in the reference manual
Prior to this commit, the main() method attempted to retrieve a TransferService bean from the context, but no such bean had been configured in the context. This commit addresses that by configuring a TransferService bean in the context. Closes gh-33446
1 parent 22abcf9 commit 61b5b1e

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

framework-docs/modules/ROOT/pages/core/beans/java/composing-configuration-classes.adoc

+23-1
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ Java::
627627
628628
@Bean
629629
public TransferService transferService() {
630-
return new TransferService(accountRepository());
630+
return new TransferServiceImpl(accountRepository());
631631
}
632632
}
633633
----
@@ -776,6 +776,17 @@ Java::
776776
public DataSource dataSource() {
777777
return new DriverManagerDataSource(url, username, password);
778778
}
779+
780+
@Bean
781+
public AccountRepository accountRepository(DataSource dataSource) {
782+
return new JdbcAccountRepository(dataSource);
783+
}
784+
785+
@Bean
786+
public TransferService transferService(AccountRepository accountRepository) {
787+
return new TransferServiceImpl(accountRepository);
788+
}
789+
779790
}
780791
----
781792
@@ -800,6 +811,17 @@ Kotlin::
800811
fun dataSource(): DataSource {
801812
return DriverManagerDataSource(url, username, password)
802813
}
814+
815+
@Bean
816+
fun accountRepository(dataSource: DataSource): AccountRepository {
817+
return JdbcAccountRepository(dataSource)
818+
}
819+
820+
@Bean
821+
fun transferService(accountRepository: AccountRepository): TransferService {
822+
return TransferServiceImpl(accountRepository)
823+
}
824+
803825
}
804826
----
805827
======

0 commit comments

Comments
 (0)