October 2017
Intermediate to advanced
396 pages
10h 2m
English
Using the injection, Spring also provides you with two basic options as the <property> element and p-namespace introduced in Spring 3.0. The p-namespace also reduced verbosity of code in the application, which is the only difference between them, you can choose any one. Let's inject the collaborating beans with the setter injection as follows:
<bean id="transferService" class="com.packt.patterninspring.chapter4. bankapp.service.TransferServiceImpl">
<property name="accountRepository" ref="accountRepository"/>
<property name="transferRepository" ref="transferRepository"/>
</bean> <bean id="accountRepository" class="com.packt.patterninspring.chapter4. bankapp.repository.jdbc.JdbcAccountRepository"/> <bean id="transferRepository" ...Read now
Unlock full access