Thursday, April 11, 2013

Buying Getting started with Spring Framework book in India

Here are some of the online stores in India from which you can buy Getting started with Spring Framework book:

Thursday, March 21, 2013

PDF version of Getting started with Spring Framework

If you want to buy a PDF version of Getting started with Spring Framework book, please visit the following Smashwords link: https://www.smashwords.com/books/view/271548

Wednesday, March 6, 2013

Book review at DZone

Many thanks to Ivan Kirkpatrick for taking the time to review Getting started with Spring Framework book.

Review summary
In summary this book represents a very good and practical introduction to the the Spring Framework. The examples in the text and the supporting source code are very clear and include practical advice for most real world situations. I recommend this book for those seeking a good solid and practical approach to learning the Spring Framework.


The complete review is available here: http://books.dzone.com/reviews/getting-started-spring

Monday, January 7, 2013

Thursday, January 3, 2013

Monday, December 31, 2012

Bean definition inheritance

This artcle is taken from the book Getting started with Spring Framework

The following figure shows the dependencies of different application objects in an application:


The above figure shows that the PersonalBankingDao and FixedDepositDao classes are dependent on the DatabaseOperations class. If multiple beans in your application share a common set of configuration (properties, constructor arguments, and so on), you can create a bean definition that acts as a parent for other bean definitions.

The following example listing shows that the PersonalBankingDao and FixedDepositDao bean definitions make use of bean definition inheritance to specify that they are dependent on DatabaseOperations bean:

<bean id="databaseOperations" 
      class="sample.spring.chapter01.springbankapp.utils.DatabaseOperations" /> 

<bean id="daoTemplate" abstract="true"
        <property name="databaseOperations" ref="databaseOperations" /> 
</bean> 

<bean id="fixedDepositDao" parent="daoTemplate" 
      class="sample.spring.chapter01.springbankapp.dao.FixedDepositDaoImpl" /> 

<bean id="personalBankingDao" parent="daoTemplate"
        class="sample.spring.chapter01.springbankapp.dao.PersonalBankingDaoImpl" />

In the above example listing, the daoTemplate bean definition defines the common configuration shared by both the fixedDepositDao and personalBankingDao bean definitions. As both the fixedDepositDao and personalBankingDao bean definitions require the databaseOperations dependency, the daoTemplate bean definition defines the databaseOperations dependency using the <property> element. The <bean> element’s parent attribute specifies the name of the bean definition from which the configuration is inherited. As the parent attribute value is daoTemplate for fixedDepositDao and personalBankingDao bean definitions, they inherit databaseOperations property from the daoTemplate bean definition.

Tuesday, December 25, 2012

Inner beans in Spring


This artcle is taken from the book Getting started with Spring Framework

If a dependency of a bean is not shared by multiple beans, you can consider defining the dependency as an inner bean. An inner bean is defined inside a <property> or <constructor-arg> element by using the <bean> element of Spring’s beans schema. You should note that an inner bean is only accessible to the bean definition enclosing it, and not to other beans registered with the Spring container.

The following example listing shows how we generally represent bean dependencies:

<bean id="service" class="sample.spring.chapter03.springbankapp.service.FixedDepositServiceImpl">
        <property name="fixedDepositDao" ref="dao" />
</bean>

<bean id="dao" class="sample.spring.chapter03.springbankapp.dao.FixedDepositDaoImpl" />

The above example listing shows that the service bean is dependent on dao bean. If service bean is the only bean that is dependent on the dao bean, then you can define the dao bean as an inner bean of service bean, as shown here:


<bean id="service" class="sample.spring.chapter02.springbankapp.service.FixedDepositServiceImpl"> 
          <property name="fixedDepositDao">
               <bean class="sample.spring.chapter02.springbankapp.dao.FixedDepositDaoImpl" /> 
          </property> 
</bean>

In the above example listing, the bean definition for the FixedDepositDaoImpl class is inside the <property> element of service bean. If you compare the above example listing with the previous one, you’ll notice that the <property> element no longer specifies the ref attribute, and the <bean> element corresponding to FixedDepositDaoImpl class doesn’t have the id attribute anymore.