|
From: Rob B. <rob...@ve...> - 2003-12-02 04:16:28
|
Spring now provides the ability to instantiate an object using either a JavaBean no arg constructor, or any normal Java constructor. But it does not support calling methods. Also, Spring requires that a class implement the InitializingBean interface if it needs to perform some "setup" work after the setters have all been called. This means that any class that has this need is tied to the Springframework. What if the ability to call any arbitrary method was added to Spring? Then users could call "afterPropertiesSet" to do "setup" work without having to implement the InitializingBean interface. Ideally method calls could be in any order along with calls to setters. Spring would then call each in order. Thus, allowing some setters to be called, then some methods, then more setters if necessary. If this is not possible, then methods should be called after setters. This would allow complete decoupling of classes from Spring. The InitializingBean & BeanFactoryAware interfaces would no longer be needed (although could remain for backwards compatibility). This would be very useful when contributing code to other projects that do not want to have a dependency on Spring. Also, it would allow virtually any class used by /developed for another IOC framework / lightweight container to be used in Spring. Thoughts? Later Rob |