Показват се публикациите с етикет Spring. Показване на всички публикации
Показват се публикациите с етикет Spring. Показване на всички публикации

петък, 25 юли 2008 г.

C# IoC Framework


Castle (IoC Framework and Container) is an open source project for .net that aspires to simplify the development of enterprise and web applications. Offering a set of tools (working together or independently) and integration with others open source projects, Castle helps you get more done with less code and in less time.
Castle consists of:
  1. MonoRail - MVC framework inspired by ActionPack, a paradigm shift to simplicity.
  2. ActiveRecord - The enterprise data mapping pattern implemented using NHibernate
  3. MikroKernel - A lightweight inversion of control container core
  4. Windsor Container - Augments the MicroKernel with features demanded by most enterprise projects
Related topics: Inversion of Control, Dependency Injection, Apache Avalon, Apache Excalibur, Castle, Spring, Spring.Net, Hibernate, NHibernate.

http://www.castleproject.org/

Interface injection


...

Spring doesn't offer support for interface injection as Fowler described it, but Spring does provide a couple types of "autowire" capabilities. Autowire is a means of automagically invoking setters on a target object by looking for source objects in the entire Spring context. If the target object has a setter that takes a single parameter, the type of that parameter is located in the Spring context. If Spring knows of any bean that matches the setter's type, it will invoke the setter.

As an example, if a JavaBean in Spring is set to "autowire=byType" and has a method signature of void setProperties(Properties props), Spring will look for a bean in its context that is of type Properties. If it finds one, it will pass it to the target bean's setter method. If it finds more than one source object of type Properties it will throw an exception.

Spring also has another type of autowire that uses the name of the setter property and looks for a source object with the same name. If found, the source object is passed to the target object's setter method...

As noted above, Spring's support of Interface Injection is an all or nothing approach and cannot be controlled very well. Autowire by type is a very magical type of IoC that proves too loose in many large applications, primarily because there isn't an efficient way to tell Spring which methods should be autowired and which ones are strictly off-limits....

The framework enables "autowiring" by default. To change the wiring mode, modify the spring.autowire property.

The autowire property can be set to several options: name, type, auto, constructor.


http://opensource.atlassian.com/confluence/spring/display/DISC/Adding+Interface+Injection+to+Spring
http://cwiki.apache.org/WW/spring.html