October 2017
Intermediate to advanced
396 pages
10h 2m
English
In the preceding code, I declared the beans TransferService, AccountRepository, and TransferRepository; these beans had no dependencies. But, actually, the TransferService bean depends on AccountRepository and TransferRepository. Let's see the following changes made in the AppConfig class to declare the beans:
package com.packt.patterninspring.chapter4.bankapp.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class AppConfig {
@Bean
public TransferService transferService(){
return new TransferServiceImpl(accountRepository(), transferRepository()); } @Bean public AccountRepository accountRepository() { return new JdbcAccountRepository(); ...Read now
Unlock full access