作者:艾灸养生加盟 | 来源:互联网 | 2023-10-13 10:00
IhaveacoupleofobjectsinSpring.NETthatIhavecreatedintherequestscope.Thisworksfinew
I have a couple of objects in Spring.NET that I have created in the request scope. This works fine when the instance exists but sometimes they need to be null. If I return null from the factory that creates them I get an error from Spring.NET indicating that it cannot wrap a null object. I gather it is trying to create a proxy around the object and failing to do so since it is null.
我在Spring.NET中有几个在请求范围内创建的对象。当实例存在时,这可以正常工作,但有时它们需要为null。如果我从创建它们的工厂返回null,我从Spring.NET收到一个错误,表明它无法包装一个null对象。我收集它是试图围绕对象创建一个代理,因为它是null,所以没有这样做。
How do I get Spring.NET to accept a null from a factory method?
如何让Spring.NET从工厂方法接受null?
1 个解决方案