I’m looking for generic support of Func factory injection in Spring .NET – the same functionality which provides Typed Factory Facility for Castle Windsor, but I’m not able to figure out how to support this kind of factory injection in Spring. Is there any extension point in Spring I could use to support this kind of functionality?
Share
At the moment this is not supported out-of-the-box. However, it is possible to create an
IFactoryObjectthat simply executes aFunc<T>on theGetObject()call. See for instance this implementation on github (by one of the regular Spring.net committers) where aFuncBasedObjectCreator<T> : IFactoryObjectis used.In the example, you’ll see that the author also created several extension for
IConfigurableApplicationContextthat utilize thisFuncBasedObjectCreator.