Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Context/Support
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv23865/src/Spring/Spring.Core/Context/Support
Modified Files:
ContextRegistry.cs
Log Message:
fixed SPRNET-394
fixed SPRNET-886
Index: ContextRegistry.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Context/Support/ContextRegistry.cs,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** ContextRegistry.cs 21 Mar 2007 19:24:11 -0000 1.27
--- ContextRegistry.cs 21 Mar 2008 10:49:37 -0000 1.28
***************
*** 24,28 ****
using System.Collections;
using System.Collections.Specialized;
!
using Common.Logging;
--- 24,28 ----
using System.Collections;
using System.Collections.Specialized;
! using System.Configuration;
using Common.Logging;
***************
*** 260,268 ****
}
private static void InitializeContextIfNeeded()
{
if (rootContextName == null)
{
! ConfigurationUtils.GetSection(AbstractApplicationContext.ContextSectionName);
}
}
--- 260,283 ----
}
+ private static bool rootContextCurrentlyInCreation;
+
private static void InitializeContextIfNeeded()
{
if (rootContextName == null)
{
! if (rootContextCurrentlyInCreation)
! {
! throw new InvalidOperationException("root context is currently in creation. You must not call ContextRegistry.GetContext() from e.g. constructors of your singleton objects");
! }
!
! rootContextCurrentlyInCreation = true;
! try
! {
! ConfigurationUtils.GetSection(AbstractApplicationContext.ContextSectionName);
! }
! finally
! {
! rootContextCurrentlyInCreation = false;
! }
}
}
|