Skip to main content

skip to main content

developerWorks  >  Web development  >

The Spring series, Part 1: Introduction to the Spring framework

A first look at Spring AOP and the IOC container

developerWorks

Return to article

When you print this page, select the landscape layout option.


Listing 7. The config file

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" 
         "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>

<bean id="createCreditCard" -->define createCreditCard definition
class="springexample.creditcardaccount.CreateCreditCardAccount">
<property name="creditRatingInterface">-->inject creditRatingInterface dependency  via creditRating reference bean
<ref bean="creditRating" />
</property>
<property name="creditLinkingInterface">">-->inject creditLinkingInterface dependency  via creditLinking reference bean
<ref bean="creditLinking" />
</property>
<property name="emailInterface">">">-->inject emailInterface dependency  via email reference bean
<ref bean="email" />
/property>
</bean>

<bean id="creditLinking" class="springexample.creditlinking.CreditLinking">
<property name="url">
<value>http://localhost/creditLinkService</value>-->set url property value 
</property>
</bean>

<bean id="creditRating" class="springexample.creditrating.CreditRating">
</bean>

<bean id="email" class="springexample.email.Email">
<property name="smtpHost">
<value>localhost</value>>-->set smpHtpHost property value 
</property>
<property name="fromEmail">
<value>mycompanyadmin@mycompanyadmin.com</value>
</property>
<property name="userId">
<value>myuserid</value>
</property>
<property name="password">
<value>mypassword</value>
</property>
</bean>
</beans>

Return to article.