Skip to content
Snippets Groups Projects
Commit bf0cb7b3 authored by felmer's avatar felmer
Browse files

throwing an exception if the application context is built twice.

SVN: 21821
parent 03bca043
No related branches found
No related tags found
No related merge requests found
......@@ -39,6 +39,8 @@ public class ServiceProvider
// applicationContex it lazily initialized
private static BeanFactory applicationContext = null;
private static boolean buildingApplicationContext;
/**
* @deprecated This method should only be used from {@link ServiceProviderTestWrapper} to avoid
......@@ -64,8 +66,16 @@ public class ServiceProvider
{
if (applicationContext == null)
{
if (buildingApplicationContext)
{
throw new IllegalStateException("Building application context. "
+ "Application context hasn't been built completely. "
+ "Beans should access other beans lazily.");
}
buildingApplicationContext = true;
applicationContext = new ClassPathXmlApplicationContext(new String[]
{ "dssApplicationContext.xml" }, true);
buildingApplicationContext = false;
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment