View Full Version : Does StaticApplicationContext Work?
02-02-2006, 12:36 AM
Been trying to:
StaticApplicationContext context = new StaticApplicationContext();
The following exception is thrown:
02-02-2006, 01:32 PM
It works, but not the way you are using it and I'm not quite sure why would you want to use it.
StaticApplicationContext only allows you to register existing singleton instances with it. It doesn't support object definitions, which means that it doesn't support ConfigureObject method either.
I'm not sure what your use case is, but if you want to configure existing objects based on templates specified in the Spring config file you should use either XmlApplicationContext or WebApplicationContext instead and mark definitions as abstract so they are not instantiated.
02-02-2006, 02:14 PM
Thanks for the response.
The use case in question involves injecting an instance of a dynamic mock object (NMock) via Spring.
I wasn't aware of the ability to mark object definitions as abstract. I'm already using XmlApplicationContext, so I'll give that a try.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.