Given the following Code.
[TestMethod] public void CanResolveILoggerTest()
{
var Container = new Castle.Windsor.WindsorContainer();
Container.Register(
Component.For<Castle.Core.Logging.ILogger>()
.ImplementedBy<Castle.Core.Logging.TraceLogger>(),
Component.For<NeedsLogger>()
);
var blah = Container.Resolve<NeedsLogger>();
}
public class NeedsLogger
{
public NeedsLogger()
{
throw new Exception("container shouldn't resolve me");
}
Castle.Core.Logging.ILogger logger;
public NeedsLogger(Castle.Core.Logging.ILogger logger)
{
this.logger = logger;
}
}
why is the default NeedsLogger constructor is called instead of the one with a dependency.