Factory method pattern aims to encapsulate object creation process within a separate method in your system. That’s why it is called as so. Factory methods can be created as either static or instance methods within a class. In Spring Application Framework, although it is possible to make use of static or instance factory methods to […]
Category: Design Patterns
What is the difference between Strategy and Template Method patterns…, if there is any?
In our Spring book, we discuss about transaction management mechanisms available in the Spring Framework, namely declarative and programmatic transactions. It is further explained inside programmatic transaction demarcation section, that how programmatic transaction can be achieved using different methods. One of the ways programmatic transaction can be achieved is, using TransactionTemplate utility class provided by […]
Wiring a Bean with BeanReferenceFactoryBean
For some reason or other you may have more than one bean definition with same type configured in you application context, and you may want to use only one of them based on some condition or configuration option. For example, I have two PlatformTransactionManager beans configured in my application context. <bean id=”jdbcTransactionManager” class=”org.springframework.jdbc.datasource.DataSourceTransactionManager”> <property […]
Some Thoughts About Constant Interface (Anti)Pattern
I have recently restarted to read Effective Java Programming Language book written by Joshua Bloch. Actually, I had skimmed it several times before, but had no chance to cover it from beginning to end yet. I want to express some of my thoughts about Item 17: Use interfaces only to define types. In this item, […]