kirov-opensource / NAutowired

ASP.NET CORE Field Injection Implement
MIT License
77 stars 16 forks source link

.Net 5 WebApi 基于接口的循环依赖会导致堆栈溢出 #23

Closed zhouandke closed 2 years ago

zhouandke commented 2 years ago

类定义 public interface IA { } public interface IB { }

public class A : IA { [Autowired] private readonly IB B; }

public class B : IB { [Autowired] private readonly IA A; }

注册 services.AddScoped<IA, A>(); services.AddScoped<IB, B>();

当controller有一个 IB 的字段时,就会导致溢出

softworm commented 2 years ago

已做增强pr,等待仓主发版吧 :)

FatTigerWang commented 2 years ago

2.3.1版本已经发布